Unverified Commit 44073a7a authored by Ning Xie's avatar Ning Xie Committed by GitHub
Browse files

[BUGFIX] catch subclass first for try...except (#18672)


Signed-off-by: default avatarAndy Xie <andy.xning@gmail.com>
parent 63934543
...@@ -319,6 +319,7 @@ def download_safetensors_index_file_from_hf( ...@@ -319,6 +319,7 @@ def download_safetensors_index_file_from_hf(
Args: Args:
model_name_or_path (str): The model name or path. model_name_or_path (str): The model name or path.
index_file (str): The safetensors index file name
cache_dir (Optional[str]): The cache directory to store the model cache_dir (Optional[str]): The cache directory to store the model
weights. If None, will use HF defaults. weights. If None, will use HF defaults.
revision (Optional[str]): The revision of the model. revision (Optional[str]): The revision of the model.
...@@ -337,10 +338,10 @@ def download_safetensors_index_file_from_hf( ...@@ -337,10 +338,10 @@ def download_safetensors_index_file_from_hf(
) )
# If file not found on remote or locally, we should not fail since # If file not found on remote or locally, we should not fail since
# only some models will have index_file. # only some models will have index_file.
except huggingface_hub.utils.EntryNotFoundError:
logger.info("No %s found in remote.", index_file)
except huggingface_hub.utils.LocalEntryNotFoundError: except huggingface_hub.utils.LocalEntryNotFoundError:
logger.info("No %s found in local cache.", index_file) logger.info("No %s found in local cache.", index_file)
except huggingface_hub.utils.EntryNotFoundError:
logger.info("No %s found in remote.", index_file)
# For models like Mistral-7B-v0.3, there are both sharded # For models like Mistral-7B-v0.3, there are both sharded
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment