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):