fix: remove overwritten model layers
if create overrides a manifest, first add the older manifest's layers to the delete map so they can be cleaned up
This commit is contained in:
parent
3b76e736ae
commit
c08dfaa23d
1 changed files with 7 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue