Skip to content

Commit d5c1772

Browse files
committed
up
1 parent 69920ef commit d5c1772

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/diffusers/utils/hub_utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
)
4646
from packaging import version
4747
from requests import HTTPError
48+
from requests.exceptions import ConnectionError
4849

4950
from .. import __version__
5051
from .constants import (
@@ -407,13 +408,18 @@ def _get_checkpoint_shard_files(
407408
local = False
408409
try:
409410
model_files_info = model_info(pretrained_model_name_or_path, revision=revision, token=token)
410-
except HTTPError:
411+
except ConnectionError as e:
411412
if local_files_only:
412413
temp_dir = snapshot_download(
413414
repo_id=pretrained_model_name_or_path, cache_dir=cache_dir, local_files_only=local_files_only
414415
)
415416
model_files_info = _get_filepaths_for_folder(temp_dir)
416417
local = True
418+
else:
419+
raise EnvironmentError(
420+
f"We couldn't connect to '{HUGGINGFACE_CO_RESOLVE_ENDPOINT}' to load {pretrained_model_name_or_path}. You should try"
421+
" again after checking your internet connection."
422+
) from e
417423
for shard_file in original_shard_filenames:
418424
if local:
419425
shard_file_present = any(shard_file in k for k in model_files_info)

0 commit comments

Comments
 (0)