Skip to content

Commit

Permalink
Explicit server error on gated model (huggingface#28894)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wauplin authored Feb 6, 2024
1 parent 89439fe commit a1afec9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/transformers/utils/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,8 @@ def cached_file(
if resolved_file is not None or not _raise_exceptions_for_gated_repo:
return resolved_file
raise EnvironmentError(
"You are trying to access a gated repo.\nMake sure to request access at "
f"https://huggingface.co/{path_or_repo_id} and pass a token having permission to this repo either "
"by logging in with `huggingface-cli login` or by passing `token=<your_token>`."
"You are trying to access a gated repo.\nMake sure to have access to it at "
f"https://huggingface.co/{path_or_repo_id}.\n{str(e)}"
) from e
except RepositoryNotFoundError as e:
raise EnvironmentError(
Expand Down

0 comments on commit a1afec9

Please sign in to comment.