mirror of
https://github.com/mudler/LocalAI.git
synced 2026-06-14 03:37:47 -04:00
model: fix case-insensitive suffix matching and skip .bak files in ListFilesInModelPath (#10306)
model: skip .bak files and fix case-insensitive suffix matching in ListFilesInModelPath
This commit is contained in:
@@ -193,8 +193,7 @@ var knownModelsNameSuffixToSkip []string = []string{
|
||||
".pt",
|
||||
".onnx",
|
||||
".md",
|
||||
".MD",
|
||||
".DS_Store",
|
||||
".ds_store",
|
||||
".",
|
||||
".safetensors",
|
||||
".bin",
|
||||
@@ -203,6 +202,7 @@ var knownModelsNameSuffixToSkip []string = []string{
|
||||
".ckpt",
|
||||
".zip",
|
||||
".tag",
|
||||
".bak",
|
||||
".partial",
|
||||
".tar.gz",
|
||||
}
|
||||
@@ -225,12 +225,18 @@ FILE:
|
||||
}
|
||||
}
|
||||
|
||||
// Skip templates, YAML, .keep, .json, and .DS_Store files
|
||||
// Skip templates, YAML, .keep, .json, .DS_Store, and other non-model files.
|
||||
// Use case-insensitive matching so e.g. CACHEDIR.TAG is caught by ".tag".
|
||||
lowerName := strings.ToLower(file.Name())
|
||||
for _, skip := range knownModelsNameSuffixToSkip {
|
||||
if strings.HasSuffix(file.Name(), skip) {
|
||||
if strings.HasSuffix(lowerName, skip) {
|
||||
continue FILE
|
||||
}
|
||||
}
|
||||
// Skip backup files created by LocalAI or huggingface_hub (e.g. model.yaml.bak-pre-gpumem072).
|
||||
if strings.Contains(lowerName, ".bak") {
|
||||
continue FILE
|
||||
}
|
||||
|
||||
// Skip directories
|
||||
if file.IsDir() {
|
||||
|
||||
Reference in New Issue
Block a user