learnmlf commited on
Commit
71a3ef4
·
1 Parent(s): 0fb37f3

fix: migrate from deprecated cached_download to hf_hub_download

Browse files

- Remove deprecated cached_download import from huggingface_hub
- Replace cached_download() calls with hf_hub_download()
- Update use_auth_token parameter to token (new API)
- Set huggingface_hub>=0.20.0 and transformers==4.36.0
- Resolves ImportError and ensures compatibility with latest packages

diffusers/utils/dynamic_modules_utils.py CHANGED
@@ -25,7 +25,7 @@ from pathlib import Path
25
  from typing import Dict, Optional, Union
26
  from urllib import request
27
 
28
- from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info
29
  from packaging import version
30
 
31
  from .. import __version__
@@ -282,14 +282,15 @@ def get_cached_module_file(
282
  # community pipeline on GitHub
283
  github_url = COMMUNITY_PIPELINES_URL.format(revision=revision, pipeline=pretrained_model_name_or_path)
284
  try:
285
- resolved_module_file = cached_download(
286
- github_url,
 
287
  cache_dir=cache_dir,
288
  force_download=force_download,
289
  proxies=proxies,
290
  resume_download=resume_download,
291
  local_files_only=local_files_only,
292
- use_auth_token=False,
293
  )
294
  submodule = "git"
295
  module_file = pretrained_model_name_or_path + ".py"
@@ -307,7 +308,7 @@ def get_cached_module_file(
307
  proxies=proxies,
308
  resume_download=resume_download,
309
  local_files_only=local_files_only,
310
- use_auth_token=use_auth_token,
311
  )
312
  submodule = os.path.join("local", "--".join(pretrained_model_name_or_path.split("/")))
313
  except EnvironmentError:
 
25
  from typing import Dict, Optional, Union
26
  from urllib import request
27
 
28
+ from huggingface_hub import HfFolder, hf_hub_download, model_info
29
  from packaging import version
30
 
31
  from .. import __version__
 
282
  # community pipeline on GitHub
283
  github_url = COMMUNITY_PIPELINES_URL.format(revision=revision, pipeline=pretrained_model_name_or_path)
284
  try:
285
+ resolved_module_file = hf_hub_download(
286
+ pretrained_model_name_or_path,
287
+ module_file,
288
  cache_dir=cache_dir,
289
  force_download=force_download,
290
  proxies=proxies,
291
  resume_download=resume_download,
292
  local_files_only=local_files_only,
293
+ token=False,
294
  )
295
  submodule = "git"
296
  module_file = pretrained_model_name_or_path + ".py"
 
308
  proxies=proxies,
309
  resume_download=resume_download,
310
  local_files_only=local_files_only,
311
+ token=use_auth_token,
312
  )
313
  submodule = os.path.join("local", "--".join(pretrained_model_name_or_path.split("/")))
314
  except EnvironmentError:
requirements.txt CHANGED
@@ -17,8 +17,9 @@ matplotlib
17
  imageio[ffmpeg]
18
  imageio[pyav]
19
  omegaconf
20
- transformers
21
  accelerate
 
22
  mediapipe==0.10.13
23
  protobuf==4.25.3
24
  xformers==0.0.23
 
17
  imageio[ffmpeg]
18
  imageio[pyav]
19
  omegaconf
20
+ transformers==4.36.0
21
  accelerate
22
+ huggingface_hub>=0.20.0
23
  mediapipe==0.10.13
24
  protobuf==4.25.3
25
  xformers==0.0.23