fix too relaxed model glob (breaking multifile)

This commit is contained in:
alex 2023-05-04 00:16:12 +02:00
parent b59c371035
commit 2b7cf9f32b

View file

@ -1039,7 +1039,12 @@ def load_some_model(path: Path) -> ModelPlus:
'''Load a model of any supported format.'''
# Be extra-friendly and accept either a file or a directory:
if path.is_dir():
globs = ["consolidated.00.pth", "pytorch_model*.bin", "*.pt"]
globs = [
"consolidated.00.pth",
"pytorch_model.bin",
"pytorch_model-00001-of-*.bin",
"*.pt"
]
files = [file for glob in globs for file in path.glob(glob)]
if not files:
# Try GGML too, but with lower priority, since if both a non-GGML