Check for single-file safetensors model
This commit is contained in:
parent
4dce910cbc
commit
c7bae1e125
1 changed files with 2 additions and 1 deletions
|
@ -1036,7 +1036,8 @@ def load_some_model(path: Path) -> ModelPlus:
|
||||||
# Be extra-friendly and accept either a file or a directory:
|
# Be extra-friendly and accept either a file or a directory:
|
||||||
if path.is_dir():
|
if path.is_dir():
|
||||||
# Check if it's a set of safetensors files first
|
# Check if it's a set of safetensors files first
|
||||||
files = list(path.glob("model-00001-of-*.safetensors"))
|
globs = ["model-00001-of-*.safetensors", "model.safetensors"]
|
||||||
|
files = [file for glob in globs for file in path.glob(glob)]
|
||||||
if not files:
|
if not files:
|
||||||
# Try the PyTorch patterns too, with lower priority
|
# Try the PyTorch patterns too, with lower priority
|
||||||
globs = ["consolidated.00.pth", "pytorch_model-00001-of-*.bin", "*.pt", "pytorch_model.bin"]
|
globs = ["consolidated.00.pth", "pytorch_model-00001-of-*.bin", "*.pt", "pytorch_model.bin"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue