fix: check if model files exist before returning cached path (#624)

This commit is contained in:
George
2026-04-10 14:11:02 +07:00
committed by GitHub
parent 21df54e3a4
commit 2b069d2fbd

View File

@@ -413,7 +413,7 @@ class ModelManagement(Generic[T]):
try:
cache_kwargs = deepcopy(kwargs)
cache_kwargs["local_files_only"] = True
return Path(
resolved_path = Path(
cls.download_files_from_huggingface(
hf_source,
cache_dir=cache_dir,
@@ -421,6 +421,10 @@ class ModelManagement(Generic[T]):
**cache_kwargs,
)
)
if (resolved_path / model.model_file).exists() and all(
(resolved_path / file).exists() for file in extra_patterns
):
return resolved_path
except Exception:
pass
finally: