Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed reference to HUGGINGFACE_CO_RESOLVE_ENDPOINT, which no longer… #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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