fix: catch httperror from ratelimiting hf when checking user token (#2827)

This commit is contained in:
NanoCode012
2025-06-25 20:50:13 +07:00
committed by GitHub
parent 20106116da
commit 181cc3106b

View File

@@ -6,6 +6,7 @@ from pathlib import Path
from accelerate.commands.config import config_args
from huggingface_hub import HfApi
from huggingface_hub.utils import LocalTokenNotFoundError
from requests import HTTPError
from axolotl.utils.logging import get_logger
@@ -46,3 +47,8 @@ def check_user_token() -> bool:
"Error verifying HuggingFace token. Remember to log in using `huggingface-cli login` and get your access token from https://huggingface.co/settings/tokens if you want to use gated models or datasets."
)
return False
except HTTPError:
LOG.warning(
"Error accessing HuggingFace. This may be due to a network issue or rate limiting."
)
return False