debugging

This commit is contained in:
Chranos
2026-02-10 15:47:48 +08:00
parent 8f2ae4f67e
commit 893eeb2208

View File

@@ -89,9 +89,10 @@ def file_or_path_exists(model: Union[str, Path], config_name, revision,
# hf_hub. This will fail in offline mode.
try:
return file_exists(model, config_name, revision=revision, token=token)
except huggingface_hub.errors.OfflineModeIsEnabled:
# Don't raise in offline mode, all we know is that we don't have this
# file cached.
except (huggingface_hub.errors.OfflineModeIsEnabled,
huggingface_hub.errors.HFValidationError):
# Don't raise in offline mode or when model path fails HF validation
# (e.g., local paths that don't match HF repo id format)
return False
@@ -169,12 +170,6 @@ def get_config(
token=token):
config_format = ConfigFormat.MISTRAL
else:
# If we're in offline mode and found no valid config format, then
# raise an offline mode error to indicate to the user that they
# don't have files cached and may need to go online.
# This is conveniently triggered by calling file_exists().
file_exists(model, HF_CONFIG_NAME, revision=revision, token=token)
raise ValueError(f"No supported config format found in {model}")
if config_format == ConfigFormat.HF: