fix: catch httperror from ratelimiting hf when checking user token (#2827)
This commit is contained in:
@@ -6,6 +6,7 @@ from pathlib import Path
|
|||||||
from accelerate.commands.config import config_args
|
from accelerate.commands.config import config_args
|
||||||
from huggingface_hub import HfApi
|
from huggingface_hub import HfApi
|
||||||
from huggingface_hub.utils import LocalTokenNotFoundError
|
from huggingface_hub.utils import LocalTokenNotFoundError
|
||||||
|
from requests import HTTPError
|
||||||
|
|
||||||
from axolotl.utils.logging import get_logger
|
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."
|
"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
|
return False
|
||||||
|
except HTTPError:
|
||||||
|
LOG.warning(
|
||||||
|
"Error accessing HuggingFace. This may be due to a network issue or rate limiting."
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user