From 71141deb185a69c55ae2d5aafa05ca070790deb2 Mon Sep 17 00:00:00 2001 From: James Wade Date: Wed, 24 Jan 2024 00:41:47 -0500 Subject: [PATCH] Add support for offline mode with HF_HUB_OFFLINE envvar (#1182) * Add support for offline mode with HF_HUB_OFFLINE envvar * Apply styling * chore: lint --------- Co-authored-by: Wing Lian --- src/axolotl/cli/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/axolotl/cli/__init__.py b/src/axolotl/cli/__init__.py index d89d676853..42458ff5d0 100644 --- a/src/axolotl/cli/__init__.py +++ b/src/axolotl/cli/__init__.py @@ -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: