File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 45
45
)
46
46
from packaging import version
47
47
from requests import HTTPError
48
+ from requests .exceptions import ConnectionError
48
49
49
50
from .. import __version__
50
51
from .constants import (
@@ -407,13 +408,18 @@ def _get_checkpoint_shard_files(
407
408
local = False
408
409
try :
409
410
model_files_info = model_info (pretrained_model_name_or_path , revision = revision , token = token )
410
- except HTTPError :
411
+ except ConnectionError as e :
411
412
if local_files_only :
412
413
temp_dir = snapshot_download (
413
414
repo_id = pretrained_model_name_or_path , cache_dir = cache_dir , local_files_only = local_files_only
414
415
)
415
416
model_files_info = _get_filepaths_for_folder (temp_dir )
416
417
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
417
423
for shard_file in original_shard_filenames :
418
424
if local :
419
425
shard_file_present = any (shard_file in k for k in model_files_info )
You can’t perform that action at this time.
0 commit comments