debugging
This commit is contained in:
@@ -89,9 +89,10 @@ def file_or_path_exists(model: Union[str, Path], config_name, revision,
|
|||||||
# hf_hub. This will fail in offline mode.
|
# hf_hub. This will fail in offline mode.
|
||||||
try:
|
try:
|
||||||
return file_exists(model, config_name, revision=revision, token=token)
|
return file_exists(model, config_name, revision=revision, token=token)
|
||||||
except huggingface_hub.errors.OfflineModeIsEnabled:
|
except (huggingface_hub.errors.OfflineModeIsEnabled,
|
||||||
# Don't raise in offline mode, all we know is that we don't have this
|
huggingface_hub.errors.HFValidationError):
|
||||||
# file cached.
|
# 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
|
return False
|
||||||
|
|
||||||
|
|
||||||
@@ -169,12 +170,6 @@ def get_config(
|
|||||||
token=token):
|
token=token):
|
||||||
config_format = ConfigFormat.MISTRAL
|
config_format = ConfigFormat.MISTRAL
|
||||||
else:
|
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}")
|
raise ValueError(f"No supported config format found in {model}")
|
||||||
|
|
||||||
if config_format == ConfigFormat.HF:
|
if config_format == ConfigFormat.HF:
|
||||||
|
|||||||
Reference in New Issue
Block a user