Skip to content

Commit c7511c7

Browse files
authored
both aria2 and torchvision.datasets.utils.download_url use HF_ENDPOINT (#1355)
both aria2 and torchvision.datasets.utils.download_url use HF_ENDPOINT to speed up
1 parent a41d8d6 commit c7511c7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

glob/manager_downloader.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616

1717
def download_url(model_url: str, model_dir: str, filename: str):
18+
if HF_ENDPOINT:
19+
model_url = model_url.replace('https://huggingface.co', HF_ENDPOINT)
1820
if aria2:
1921
return aria2_download_url(model_url, model_dir, filename)
2022
else:
@@ -44,9 +46,6 @@ def aria2_download_url(model_url: str, model_dir: str, filename: str):
4446
if model_dir.startswith(core.comfy_path):
4547
model_dir = model_dir[len(core.comfy_path) :]
4648

47-
if HF_ENDPOINT:
48-
model_url = model_url.replace('https://huggingface.co', HF_ENDPOINT)
49-
5049
download_dir = model_dir if model_dir.startswith('/') else os.path.join('/models', model_dir)
5150

5251
download = aria2_find_task(download_dir, filename)

0 commit comments

Comments
 (0)