bugfix: don't include both consolidated.safetensors and model-*.safetensors (#13010)

This commit is contained in:
Patrick Devine
2025-11-07 22:41:57 -08:00
committed by GitHub
parent 755ac3b069
commit 91ec3ddbeb
2 changed files with 275 additions and 1 deletions

View File

@@ -260,10 +260,13 @@ func filesForModel(path string) ([]string, error) {
var files []string
// some safetensors files do not properly match "application/octet-stream", so skip checking their contentType
if st, _ := glob(filepath.Join(path, "*.safetensors"), ""); len(st) > 0 {
if st, _ := glob(filepath.Join(path, "model*.safetensors"), ""); 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, "consolidated*.safetensors"), ""); len(st) > 0 {
// covers consolidated.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