From f94155fba2486ccf98c98deae5bfc4b32b398dbe Mon Sep 17 00:00:00 2001 From: Bruce MacDonald Date: Mon, 17 Mar 2025 16:33:43 -0700 Subject: [PATCH] do not add both consolidated and parts to model --- parser/parser.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/parser/parser.go b/parser/parser.go index 9a98c8ea7..eb916cbfb 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -211,15 +211,19 @@ func filesForModel(path string) ([]string, error) { } var files []string - if st, _ := glob(filepath.Join(path, "*.safetensors"), "application/octet-stream"); len(st) > 0 { + if st, _ := glob(filepath.Join(path, "consolidated.safetensors"), "application/octet-stream"); len(st) > 0 { + files = append(files, st...) + } else if st, _ := glob(filepath.Join(path, "model*.safetensors"), "application/octet-stream"); len(st) > 0 { // safetensors files might be unresolved git lfs references; skip if they are // covers model-x-of-y.safetensors, model.fp32-x-of-y.safetensors, model.safetensors files = append(files, st...) + } else if st, _ := glob(filepath.Join(path, "adapters.safetensors"), "application/octet-stream"); len(st) > 0 { + // covers adapters.safetensors + files = append(files, st...) + } else if st, _ := glob(filepath.Join(path, "adapter_model.safetensors"), "application/octet-stream"); len(st) > 0 { + // covers adapter_model.safetensors + files = append(files, st...) } else if pt, _ := glob(filepath.Join(path, "pytorch_model*.bin"), "application/zip"); len(pt) > 0 { - // pytorch files might also be unresolved git lfs references; skip if they are - // covers pytorch_model-x-of-y.bin, pytorch_model.fp32-x-of-y.bin, pytorch_model.bin - files = append(files, pt...) - } else if pt, _ := glob(filepath.Join(path, "consolidated*.pth"), "application/zip"); len(pt) > 0 { // pytorch files might also be unresolved git lfs references; skip if they are // covers consolidated.x.pth, consolidated.pth files = append(files, pt...)