Skip to content
This repository was archived by the owner on Jul 13, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions corener/utils/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
from typing import Optional, Union

from transformers import AutoConfig
from transformers.modeling_utils import (
HUGGINGFACE_CO_RESOLVE_ENDPOINT,
from huggingface_hub.utils import (
EntryNotFoundError,
HTTPError,
HfHubHTTPError,
RepositoryNotFoundError,
RevisionNotFoundError,
cached_path,
Expand All @@ -16,6 +15,7 @@
load_state_dict,
)


from corener.utils import set_logger

set_logger()
Expand Down Expand Up @@ -150,14 +150,14 @@ def load_weights_and_config(
raise EnvironmentError(
f"{pretrained_model_name_or_path} does not appear to have a file named {filename}."
)
except HTTPError as err:
except HfHubHTTPError as err:
raise EnvironmentError(
f"There was a specific connection error when trying to load {pretrained_model_name_or_path}:\n"
f"{err}"
)
except ValueError:
raise EnvironmentError(
f"We couldn't connect to '{HUGGINGFACE_CO_RESOLVE_ENDPOINT}' to load this model, couldn't find it in the cached "
f"We couldn't connect to 'HuggingFace' to load this model, couldn't find it in the cached "
f"files and it looks like {pretrained_model_name_or_path} is not the path to a directory "
f"containing a file named {WEIGHTS_NAME}.\n"
"Checkout your internet connection or see how to run the library in offline mode at "
Expand Down