diff --git a/llama/llama.go b/llama/llama.go index fe09c717..86bf0c54 100644 --- a/llama/llama.go +++ b/llama/llama.go @@ -1,7 +1,7 @@ package llama /* -#cgo CPPFLAGS: -O3 -Wall -Wextra -Werror -Wno-unused-function -Wno-unused-variable -DNDEBUG -DGGML_USE_K_QUANTS +#cgo CPPFLAGS: -O3 -Wall -Wextra -Wno-unused-function -Wno-unused-variable -DNDEBUG -DGGML_USE_K_QUANTS #cgo CXXFLAGS: -std=gnu++11 #cgo darwin CPPFLAGS: -DGGML_USE_ACCELERATE #cgo darwin,arm64 CPPFLAGS: -DGGML_USE_METAL -DGGML_METAL_NDEBUG diff --git a/server/images.go b/server/images.go index f7cbd47f..852c5cdc 100644 --- a/server/images.go +++ b/server/images.go @@ -271,7 +271,19 @@ func CreateModel(name string, path string, fn func(resp api.ProgressResponse)) e layers = append(layers, newLayer) } } - case "license", "template", "system", "prompt": + case "license": + fn(api.ProgressResponse{Status: fmt.Sprintf("creating model %s layer", c.Name)}) + // remove the prompt layer if one exists + mediaType := fmt.Sprintf("application/vnd.ollama.image.%s", c.Name) + + layer, err := CreateLayer(strings.NewReader(c.Args)) + if err != nil { + return err + } + + layer.MediaType = mediaType + layers = append(layers, layer) + case "template", "system", "prompt": fn(api.ProgressResponse{Status: fmt.Sprintf("creating model %s layer", c.Name)}) // remove the prompt layer if one exists mediaType := fmt.Sprintf("application/vnd.ollama.image.%s", c.Name) @@ -590,6 +602,9 @@ func DeleteModel(name string) error { } return nil }) + if err != nil { + return err + } if err != nil { return err @@ -873,14 +888,11 @@ func checkBlobExistence(mp ModelPath, digest string, regOpts *RegistryOptions) ( return resp.StatusCode == http.StatusOK, nil } -func uploadBlobChunked(mp ModelPath, location string, layer *Layer, regOpts *RegistryOptions, fn func(api.ProgressResponse)) error { +func uploadBlobChunked(mp ModelPath, url string, layer *Layer, regOpts *RegistryOptions, fn func(api.ProgressResponse)) error { // TODO allow resumability // TODO allow canceling uploads via DELETE // TODO allow cross repo blob mount - // Create URL - url := location - fp, err := GetBlobsPath(layer.Digest) if err != nil { return err