Skip to content

Commit

Permalink
[hub] Upgrade deprecated huggingface_hub.cached_download (#645)
Browse files Browse the repository at this point in the history
* Replace huggingface_hub.cached_download with huggingface_hub.hf_hub_download

* Reintroduce cache_dir
  • Loading branch information
mattiadg authored Oct 24, 2022
1 parent 8048880 commit 140733b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions asteroid/utils/hub_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ def cached_download(filename_or_url):
else:
model_id = filename_or_url
revision = None
url = huggingface_hub.hf_hub_url(
model_id, filename=huggingface_hub.PYTORCH_WEIGHTS_NAME, revision=revision
)
return huggingface_hub.cached_download(
url,
return huggingface_hub.hf_hub_download(
repo_id=model_id,
filename=huggingface_hub.PYTORCH_WEIGHTS_NAME,
cache_dir=get_cache_dir(),
revision=revision,
library_name="asteroid",
library_version=asteroid_version,
)

cached_filename = url_to_filename(url)
cached_dir = os.path.join(get_cache_dir(), cached_filename)
cached_path = os.path.join(cached_dir, "model.pth")
Expand Down

0 comments on commit 140733b

Please sign in to comment.