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 <wing.lian@gmail.com>
This commit is contained in:
@@ -365,6 +365,13 @@ def check_accelerate_default_config():
|
|||||||
|
|
||||||
|
|
||||||
def check_user_token():
|
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
|
# Verify if token is valid
|
||||||
api = HfApi()
|
api = HfApi()
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user