From 319f078dd981d1a5cb3445db238683df9d1481d6 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Mon, 31 Jul 2023 15:54:10 -0700 Subject: [PATCH 1/4] remove -Werror there are compile warnings on Linux which -Werror elevates to errors, preventing compile --- llama/llama.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 70e0ab6b3d5777e265bd96130d176ab2b1f9e86c Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Mon, 31 Jul 2023 15:02:07 -0700 Subject: [PATCH 2/4] remove unnecessary fmt.Sprintf --- server/images.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/server/images.go b/server/images.go index f7cbd47f..19ce467e 100644 --- a/server/images.go +++ b/server/images.go @@ -873,14 +873,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 From 203fdbc4b8b69f1ed291e41c4f535913f7b73acc Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Mon, 31 Jul 2023 15:26:18 -0700 Subject: [PATCH 3/4] check err --- server/images.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/images.go b/server/images.go index 19ce467e..53ffb9a8 100644 --- a/server/images.go +++ b/server/images.go @@ -590,6 +590,9 @@ func DeleteModel(name string) error { } return nil }) + if err != nil { + return err + } if err != nil { return err From 872011630aeadc97e0e9d0b4e7d1d7f5de05e926 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Mon, 31 Jul 2023 21:34:52 -0700 Subject: [PATCH 4/4] fix license --- server/images.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/images.go b/server/images.go index 53ffb9a8..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)