From 9c5da8bf001a29ef6e74d7b40b5c3f8e0fe7b0d6 Mon Sep 17 00:00:00 2001 From: James Wade Date: Tue, 23 Jan 2024 18:11:15 -0500 Subject: [PATCH 1/3] Add support for offline mode with HF_HUB_OFFLINE envvar --- src/axolotl/cli/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/axolotl/cli/__init__.py b/src/axolotl/cli/__init__.py index d89d676853..d8164f4c8d 100644 --- a/src/axolotl/cli/__init__.py +++ b/src/axolotl/cli/__init__.py @@ -365,6 +365,11 @@ 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: From 090a82d7712a0e8905b0aae692c87d23f253e690 Mon Sep 17 00:00:00 2001 From: James Wade Date: Tue, 23 Jan 2024 20:13:54 -0500 Subject: [PATCH 2/3] Apply styling --- src/axolotl/cli/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/axolotl/cli/__init__.py b/src/axolotl/cli/__init__.py index d8164f4c8d..fc6c9a9a7e 100644 --- a/src/axolotl/cli/__init__.py +++ b/src/axolotl/cli/__init__.py @@ -366,8 +366,10 @@ 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.") + 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 From dbc65ec44493f24c1501ff9b06a2f3aaff430d45 Mon Sep 17 00:00:00 2001 From: Wing Lian Date: Tue, 23 Jan 2024 23:36:35 -0500 Subject: [PATCH 3/3] chore: lint --- src/axolotl/cli/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/axolotl/cli/__init__.py b/src/axolotl/cli/__init__.py index fc6c9a9a7e..42458ff5d0 100644 --- a/src/axolotl/cli/__init__.py +++ b/src/axolotl/cli/__init__.py @@ -371,7 +371,7 @@ def check_user_token(): "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: