From 181cc3106b48e0ea0023a851d5a67106738fbfd1 Mon Sep 17 00:00:00 2001 From: NanoCode012 Date: Wed, 25 Jun 2025 20:50:13 +0700 Subject: [PATCH] fix: catch httperror from ratelimiting hf when checking user token (#2827) --- src/axolotl/cli/checks.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/axolotl/cli/checks.py b/src/axolotl/cli/checks.py index 10086c2a4..a743e74dc 100644 --- a/src/axolotl/cli/checks.py +++ b/src/axolotl/cli/checks.py @@ -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