Unverified Commit a1afec9e authored by Lucain's avatar Lucain Committed by GitHub
Browse files

Explicit server error on gated model (#28894)

parent 89439fea
...@@ -414,9 +414,8 @@ def cached_file( ...@@ -414,9 +414,8 @@ def cached_file(
if resolved_file is not None or not _raise_exceptions_for_gated_repo: if resolved_file is not None or not _raise_exceptions_for_gated_repo:
return resolved_file return resolved_file
raise EnvironmentError( raise EnvironmentError(
"You are trying to access a gated repo.\nMake sure to request access at " "You are trying to access a gated repo.\nMake sure to have access to it at "
f"https://huggingface.co/{path_or_repo_id} and pass a token having permission to this repo either " f"https://huggingface.co/{path_or_repo_id}.\n{str(e)}"
"by logging in with `huggingface-cli login` or by passing `token=<your_token>`."
) from e ) from e
except RepositoryNotFoundError as e: except RepositoryNotFoundError as e:
raise EnvironmentError( raise EnvironmentError(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment