mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-11 04:14:52 +00:00
Reuse the same function to list local weights everywhere
Signed-off-by: Raphael Glon <oOraph@users.noreply.github.com>
This commit is contained in:
parent
29f87920a8
commit
d5b7e6e38f
@ -125,13 +125,14 @@ def weight_files(
|
||||
) -> List[Path]:
|
||||
"""Get the local files"""
|
||||
# Local model
|
||||
if Path(model_id).exists() and Path(model_id).is_dir():
|
||||
local_files = list(Path(model_id).glob(f"*{extension}"))
|
||||
d = Path(model_id)
|
||||
if d.exists() and d.is_dir():
|
||||
local_files = _weight_files_from_dir(d, extension)
|
||||
if not local_files:
|
||||
raise FileNotFoundError(
|
||||
f"No local weights found in {model_id} with extension {extension}"
|
||||
)
|
||||
return local_files
|
||||
return [Path(f) for f in local_files]
|
||||
|
||||
try:
|
||||
filenames = weight_hub_files(model_id, revision, extension)
|
||||
|
Loading…
Reference in New Issue
Block a user