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

fixed error message for GatedRepoError #1832

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Changes from 2 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
18 changes: 12 additions & 6 deletions torchtune/_cli/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,18 @@ def _download_cmd(self, args: argparse.Namespace) -> None:
token=args.hf_token,
)
except GatedRepoError:
self._parser.error(
"It looks like you are trying to access a gated repository. Please ensure you "
"have access to the repository and have provided the proper Hugging Face API token "
"using the option `--hf-token` or by running `huggingface-cli login`."
"You can find your token by visiting https://huggingface.co/settings/tokens"
)
if args.hf_token:
self._parser.error(
"It looks like you are trying to access a gated repository. Please ensure you "
"have access to the repository."
)
else:
self._parser.error(
"It looks like you are trying to access a gated repository. Please ensure you "
"have access to the repository and have provided the proper Hugging Face API token "
"using the option `--hf-token` or by running `huggingface-cli login`."
"You can find your token by visiting https://huggingface.co/settings/tokens"
)
except RepositoryNotFoundError:
self._parser.error(
f"Repository '{args.repo_id}' not found on the Hugging Face Hub."
Expand Down
Loading