Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

fix: remove overwritten model layers

Michael Yangc08dfaa23d90
diff --git a/server/images.go b/server/images.go
index 1d0c73cce..a20f6bd77 100644
--- a/server/images.go
+++ b/server/images.go
@@ -412,6 +412,13 @@ func realpath(mfDir, from string) string {
}
func CreateModel(ctx context.Context, name, modelFileDir string, commands []parser.Command, fn func(resp api.ProgressResponse)) error {
+ deleteMap := make(map[string]struct{})
+ if manifest, _, err := GetManifest(ParseModelPath(name)); err == nil {
+ for _, layer := range append(manifest.Layers, manifest.Config) {
+ deleteMap[layer.Digest] = struct{}{}
+ }
+ }
+
config := ConfigV2{
OS: "linux",
Architecture: "amd64",
@@ -420,8 +427,6 @@ func CreateModel(ctx context.Context, name, modelFileDir string, commands []pars
},
}
- deleteMap := make(map[string]struct{})
-
var layers Layers
params := make(map[string][]string)