Skip to content

Commit

Permalink
Ensure backward compatibility for HUGGING_FACE_HUB_TOKEN env variable (
Browse files Browse the repository at this point in the history
  • Loading branch information
Wauplin authored Nov 2, 2023
1 parent f590bdf commit 2dc5620
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/huggingface_hub/utils/_hf_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def get_token(cls) -> Optional[str]:

# 1. Is it set by environment variable ?
token: Optional[str] = os.environ.get("HF_TOKEN")
if token is None: # Ensure backward compatibility but doesn't have priority
token = os.environ.get("HUGGING_FACE_HUB_TOKEN")
if token is not None:
token = token.replace("\r", "").replace("\n", "").strip()
return token
Expand Down

0 comments on commit 2dc5620

Please sign in to comment.