From 6a97f9a49f300cf220c26a5ba6cf4d373ff75851 Mon Sep 17 00:00:00 2001 From: licyk Date: Sat, 22 Mar 2025 16:37:14 +0800 Subject: [PATCH] load_file_from_url() downloads the model from HF_ENDPOINT if it is set --- modules/shared.py | 2 +- modules/util.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/shared.py b/modules/shared.py index 564f613ebb..64cca65431 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -92,4 +92,4 @@ list_samplers = shared_items.list_samplers reload_hypernetworks = shared_items.reload_hypernetworks -hf_endpoint = os.getenv('HF_ENDPOINT', 'https://huggingface.co') +hf_endpoint = os.getenv('HF_ENDPOINT', 'https://huggingface.co').rstrip('/') diff --git a/modules/util.py b/modules/util.py index 5ab112ba8e..5ddb331a6b 100644 --- a/modules/util.py +++ b/modules/util.py @@ -239,6 +239,7 @@ def load_file_from_url( parts = urlparse(url) file_name = os.path.basename(parts.path) + url = str.replace(url, "https://huggingface.co", shared.hf_endpoint, 1) cached_file = os.path.abspath(os.path.join(model_dir, file_name)) if re_download or not os.path.exists(cached_file):