James Wade winglian commited on
Commit
71141de
·
unverified ·
1 Parent(s): dc051b8

Add support for offline mode with HF_HUB_OFFLINE envvar (#1182)

Browse files

* Add support for offline mode with HF_HUB_OFFLINE envvar

* Apply styling

* chore: lint

---------

Co-authored-by: Wing Lian <[email protected]>

Files changed (1) hide show
  1. src/axolotl/cli/__init__.py +7 -0
src/axolotl/cli/__init__.py CHANGED
@@ -365,6 +365,13 @@ def check_accelerate_default_config():
365
 
366
 
367
  def check_user_token():
 
 
 
 
 
 
 
368
  # Verify if token is valid
369
  api = HfApi()
370
  try:
 
365
 
366
 
367
  def check_user_token():
368
+ # Skip check if HF_HUB_OFFLINE is set to True
369
+ if os.getenv("HF_HUB_OFFLINE") == "1":
370
+ LOG.info(
371
+ "Skipping HuggingFace token verification because HF_HUB_OFFLINE is set to True. Only local files will be used."
372
+ )
373
+ return True
374
+
375
  # Verify if token is valid
376
  api = HfApi()
377
  try: