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
This commit is contained in:
learningpro 2024-12-21 16:54:34 +08:00 committed by GitHub
parent a41d8d6101
commit c7511c7aa9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,6 +15,8 @@ if aria2 is not None:
def download_url(model_url: str, model_dir: str, filename: str):
if HF_ENDPOINT:
model_url = model_url.replace('https://huggingface.co', HF_ENDPOINT)
if aria2:
return aria2_download_url(model_url, model_dir, filename)
else:
@ -44,9 +46,6 @@ def aria2_download_url(model_url: str, model_dir: str, filename: str):
if model_dir.startswith(core.comfy_path):
model_dir = model_dir[len(core.comfy_path) :]
if HF_ENDPOINT:
model_url = model_url.replace('https://huggingface.co', HF_ENDPOINT)
download_dir = model_dir if model_dir.startswith('/') else os.path.join('/models', model_dir)
download = aria2_find_task(download_dir, filename)