Skip to content

Commit

Permalink
Added support for hf_token as an environment variable (#34)
Browse files Browse the repository at this point in the history
* added support for hf_token as an environment variable
  • Loading branch information
AyushSawant18588 authored Jan 5, 2024
1 parent 1996c11 commit c9b69f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions llm/utils/generate_data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def set_values(self, params: argparse.Namespace) -> None:
self.skip_download = params.skip_download
self.debug = params.debug

self.repo_info.hf_token = params.hf_token
self.repo_info.hf_token = params.hf_token or os.environ.get("HF_TOKEN")
self.repo_info.repo_id = params.repo_id
self.repo_info.repo_version = params.repo_version

Expand Down Expand Up @@ -125,7 +125,8 @@ def validate_hf_token(self) -> None:
(
"HuggingFace Hub token is required for llama download. "
"Please specify it using --hf_token=<your token> argument "
". Refer https://huggingface.co/docs/hub/security-tokens"
"or, set it as an environment variable 'HF_TOKEN'. Refer "
"https://huggingface.co/docs/hub/security-tokens"
)
)
sys.exit(1)
Expand Down

0 comments on commit c9b69f7

Please sign in to comment.