Skip to content

Commit

Permalink
Add support for offline mode with HF_HUB_OFFLINE envvar (#1182)
Browse files Browse the repository at this point in the history
* Add support for offline mode with HF_HUB_OFFLINE envvar

* Apply styling

* chore: lint

---------

Co-authored-by: Wing Lian <wing.lian@gmail.com>
  • Loading branch information
JamesHWade and winglian committed Jan 24, 2024
1 parent dc051b8 commit 71141de
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/axolotl/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,13 @@ def check_accelerate_default_config():


def check_user_token():
# Skip check if HF_HUB_OFFLINE is set to True
if os.getenv("HF_HUB_OFFLINE") == "1":
LOG.info(
"Skipping HuggingFace token verification because HF_HUB_OFFLINE is set to True. Only local files will be used."
)
return True

# Verify if token is valid
api = HfApi()
try:
Expand Down

0 comments on commit 71141de

Please sign in to comment.