[Fix] has_hf_quant_config crashes on local dirs without the config (#34774)
Co-authored-by: harmya <harmya@modal.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
harmya
Claude Fable 5
parent
65d62109dd
commit
2622e013eb
@@ -3304,9 +3304,10 @@ def has_hf_quant_config(model_path: str) -> bool:
|
|||||||
Returns:
|
Returns:
|
||||||
True if hf_quant_config.json exists, False otherwise.
|
True if hf_quant_config.json exists, False otherwise.
|
||||||
"""
|
"""
|
||||||
# Check if the model_path is a local path
|
# Local paths are decided on the filesystem; the hub helpers below
|
||||||
if os.path.exists(os.path.join(model_path, "hf_quant_config.json")):
|
# reject them as invalid repo ids.
|
||||||
return True
|
if os.path.isdir(model_path):
|
||||||
|
return os.path.isfile(os.path.join(model_path, "hf_quant_config.json"))
|
||||||
|
|
||||||
from huggingface_hub import try_to_load_from_cache
|
from huggingface_hub import try_to_load_from_cache
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user