From 386af6c1a0e9b1f4788b000ddf98955b4ce6183b Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Fri, 23 Aug 2024 13:16:30 -0700 Subject: [PATCH 1/7] passthrough OLLAMA_HOST path to client --- envconfig/config.go | 10 +++------ envconfig/config_test.go | 47 ++++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/envconfig/config.go b/envconfig/config.go index 7e45a4f5..c13167b5 100644 --- a/envconfig/config.go +++ b/envconfig/config.go @@ -30,9 +30,7 @@ func Host() *url.URL { defaultPort = "443" } - // trim trailing slashes - hostport = strings.TrimRight(hostport, "/") - + hostport, path, _ := strings.Cut(hostport, "/") host, port, err := net.SplitHostPort(hostport) if err != nil { host, port = "127.0.0.1", defaultPort @@ -45,15 +43,13 @@ func Host() *url.URL { if n, err := strconv.ParseInt(port, 10, 32); err != nil || n > 65535 || n < 0 { slog.Warn("invalid port, using default", "port", port, "default", defaultPort) - return &url.URL{ - Scheme: scheme, - Host: net.JoinHostPort(host, defaultPort), - } + port = defaultPort } return &url.URL{ Scheme: scheme, Host: net.JoinHostPort(host, port), + Path: path, } } diff --git a/envconfig/config_test.go b/envconfig/config_test.go index 92a500f1..d52a98a5 100644 --- a/envconfig/config_test.go +++ b/envconfig/config_test.go @@ -13,34 +13,35 @@ func TestHost(t *testing.T) { value string expect string }{ - "empty": {"", "127.0.0.1:11434"}, - "only address": {"1.2.3.4", "1.2.3.4:11434"}, - "only port": {":1234", ":1234"}, - "address and port": {"1.2.3.4:1234", "1.2.3.4:1234"}, - "hostname": {"example.com", "example.com:11434"}, - "hostname and port": {"example.com:1234", "example.com:1234"}, - "zero port": {":0", ":0"}, - "too large port": {":66000", ":11434"}, - "too small port": {":-1", ":11434"}, - "ipv6 localhost": {"[::1]", "[::1]:11434"}, - "ipv6 world open": {"[::]", "[::]:11434"}, - "ipv6 no brackets": {"::1", "[::1]:11434"}, - "ipv6 + port": {"[::1]:1337", "[::1]:1337"}, - "extra space": {" 1.2.3.4 ", "1.2.3.4:11434"}, - "extra quotes": {"\"1.2.3.4\"", "1.2.3.4:11434"}, - "extra space+quotes": {" \" 1.2.3.4 \" ", "1.2.3.4:11434"}, - "extra single quotes": {"'1.2.3.4'", "1.2.3.4:11434"}, - "http": {"http://1.2.3.4", "1.2.3.4:80"}, - "http port": {"http://1.2.3.4:4321", "1.2.3.4:4321"}, - "https": {"https://1.2.3.4", "1.2.3.4:443"}, - "https port": {"https://1.2.3.4:4321", "1.2.3.4:4321"}, + "empty": {"", "http://127.0.0.1:11434"}, + "only address": {"1.2.3.4", "http://1.2.3.4:11434"}, + "only port": {":1234", "http://:1234"}, + "address and port": {"1.2.3.4:1234", "http://1.2.3.4:1234"}, + "hostname": {"example.com", "http://example.com:11434"}, + "hostname and port": {"example.com:1234", "http://example.com:1234"}, + "zero port": {":0", "http://:0"}, + "too large port": {":66000", "http://:11434"}, + "too small port": {":-1", "http://:11434"}, + "ipv6 localhost": {"[::1]", "http://[::1]:11434"}, + "ipv6 world open": {"[::]", "http://[::]:11434"}, + "ipv6 no brackets": {"::1", "http://[::1]:11434"}, + "ipv6 + port": {"[::1]:1337", "http://[::1]:1337"}, + "extra space": {" 1.2.3.4 ", "http://1.2.3.4:11434"}, + "extra quotes": {"\"1.2.3.4\"", "http://1.2.3.4:11434"}, + "extra space+quotes": {" \" 1.2.3.4 \" ", "http://1.2.3.4:11434"}, + "extra single quotes": {"'1.2.3.4'", "http://1.2.3.4:11434"}, + "http": {"http://1.2.3.4", "http://1.2.3.4:80"}, + "http port": {"http://1.2.3.4:4321", "http://1.2.3.4:4321"}, + "https": {"https://1.2.3.4", "https://1.2.3.4:443"}, + "https port": {"https://1.2.3.4:4321", "https://1.2.3.4:4321"}, + "proxy path": {"https://example.com/ollama", "https://example.com:443/ollama"}, } for name, tt := range cases { t.Run(name, func(t *testing.T) { t.Setenv("OLLAMA_HOST", tt.value) - if host := Host(); host.Host != tt.expect { - t.Errorf("%s: expected %s, got %s", name, tt.expect, host.Host) + if host := Host(); host.String() != tt.expect { + t.Errorf("%s: expected %s, got %s", name, tt.expect, host.String()) } }) } From 413ae39f3c947a65f9c940edc0319218135ba767 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Tue, 27 Aug 2024 11:34:30 -0700 Subject: [PATCH 2/7] update templates to use messages --- server/routes_create_test.go | 4 ++-- template/alfred.gotmpl | 3 ++- template/alpaca.gotmpl | 20 +++++++++++++++----- template/chatml.gotmpl | 7 ++----- template/chatqa.gotmpl | 11 ++++++----- template/codellama-70b-instruct.gotmpl | 16 ++++++++-------- template/falcon-instruct.gotmpl | 11 +++++++---- template/gemma-instruct.gotmpl | 21 ++++++++++++++++----- template/granite-instruct.gotmpl | 13 ++++++------- template/llama2-chat.gotmpl | 18 +++++++++++++----- template/llama3-instruct.gotmpl | 8 +++----- template/magicoder.gotmpl | 19 ++++++++++++++----- template/mistral-instruct.gotmpl | 7 +++++-- template/openchat.gotmpl | 7 ++++++- template/phi-3.gotmpl | 7 ++----- template/solar-instruct.gotmpl | 14 ++++++++------ template/starcoder2-instruct.gotmpl | 20 +++++++++++++++----- template/vicuna.gotmpl | 16 +++++++++++++--- template/zephyr.gotmpl | 7 ++----- 19 files changed, 145 insertions(+), 84 deletions(-) diff --git a/server/routes_create_test.go b/server/routes_create_test.go index 4de07b25..2f577eb4 100644 --- a/server/routes_create_test.go +++ b/server/routes_create_test.go @@ -593,9 +593,9 @@ func TestCreateDetectTemplate(t *testing.T) { checkFileExists(t, filepath.Join(p, "blobs", "*"), []string{ filepath.Join(p, "blobs", "sha256-0d79f567714c62c048378f2107fb332dabee0135d080c302d884317da9433cc5"), + filepath.Join(p, "blobs", "sha256-35360843d0c84fb1506952a131bbef13cd2bb4a541251f22535170c05b56e672"), filepath.Join(p, "blobs", "sha256-553c4a3f747b3d22a4946875f1cc8ed011c2930d83f864a0c7265f9ec0a20413"), - filepath.Join(p, "blobs", "sha256-c608dc615584cd20d9d830363dabf8a4783ae5d34245c3d8c115edb3bc7b28e4"), - filepath.Join(p, "blobs", "sha256-ea34c57ba5b78b740aafe2aeb74dc6507fc3ad14170b64c26a04fb9e36c88d75"), + filepath.Join(p, "blobs", "sha256-de3959f841e9ef6b4b6255fa41cb9e0a45da89c3066aa72bdd07a4747f848990"), }) }) diff --git a/template/alfred.gotmpl b/template/alfred.gotmpl index cecb9d2c..86dba48f 100644 --- a/template/alfred.gotmpl +++ b/template/alfred.gotmpl @@ -1 +1,2 @@ -{{ if .System }}{{ .System }}{{ end }}{{ if .Prompt }}{{ .Prompt }}{{ end }}{{ .Response }} \ No newline at end of file +{{- range .Messages }}{{ .Content }} +{{- end }} \ No newline at end of file diff --git a/template/alpaca.gotmpl b/template/alpaca.gotmpl index ec7a8edc..00439736 100644 --- a/template/alpaca.gotmpl +++ b/template/alpaca.gotmpl @@ -1,8 +1,18 @@ -{{ if .System }}{{ .System }} +{{- $system := "" }} +{{- range .Messages }} +{{- if eq .Role "system" }} +{{- if not $system }}{{ $system = .Content }} +{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }} +{{- end }} +{{- else if eq .Role "user" }} +{{- if $system }}{{ $system }} -{{ end }}{{ if .Prompt }}### Instruction: -{{ .Prompt }} +{{ $system = "" }} +{{- end }}### Instruction: +{{ .Content }} -{{ end }}### Response: -{{ .Response }} +{{ else if eq .Role "assistant" }}### Response: +{{ .Content }} +{{ end }} +{{- end }}### Response: diff --git a/template/chatml.gotmpl b/template/chatml.gotmpl index fb672601..43207ab1 100644 --- a/template/chatml.gotmpl +++ b/template/chatml.gotmpl @@ -1,6 +1,3 @@ -{{ if .System }}<|im_start|>system -{{ .System }}<|im_end|> -{{ end }}{{ if .Prompt }}<|im_start|>user -{{ .Prompt }}<|im_end|> +{{- range .Messages }}<|im_start|>{{ .Role }} +{{ .Content }}<|im_end|> {{ end }}<|im_start|>assistant -{{ .Response }}<|im_end|> diff --git a/template/chatqa.gotmpl b/template/chatqa.gotmpl index 91679a72..0f91e0f0 100644 --- a/template/chatqa.gotmpl +++ b/template/chatqa.gotmpl @@ -1,6 +1,7 @@ -{{ if .System }}System: {{ .System }} - -{{ end }}{{ if .Prompt }}User: {{ .Prompt }} - -{{ end }}Assistant: {{ .Response }} +{{- range .Messages }} +{{- if eq .Role "system" }}System: +{{- else if eq .Role "user" }}User: +{{- else if eq .Role "assistant" }}Assistant: +{{- end }} {{ .Content }} +{{ end }}Assistant: \ No newline at end of file diff --git a/template/codellama-70b-instruct.gotmpl b/template/codellama-70b-instruct.gotmpl index e5856042..18931520 100644 --- a/template/codellama-70b-instruct.gotmpl +++ b/template/codellama-70b-instruct.gotmpl @@ -1,10 +1,10 @@ -{{ if .System }}Source: system - - {{ .System }} {{ end }}Source: user - - {{ .Prompt }} Source: assistant -{{- if not .Response }} -Destination: user +{{- range .Messages }}Source: +{{- if eq .Role "system" }} system +{{- else if eq .Role "user" }} user +{{- else if eq .Role "assistant" }} assistant {{- end }} - {{ .Response }} \ No newline at end of file + {{ .Content }} {{ end }}Source: assistant +Destination: user + + \ No newline at end of file diff --git a/template/falcon-instruct.gotmpl b/template/falcon-instruct.gotmpl index 0a5fe48e..b9b51d2c 100644 --- a/template/falcon-instruct.gotmpl +++ b/template/falcon-instruct.gotmpl @@ -1,5 +1,8 @@ -{{ if .System }}System: {{ .System }} -{{ end }}{{ if .Prompt }}User: -{{ .Prompt }} +{{- range .Messages }} +{{- if eq .Role "system" }}System: {{ .Content }} +{{ continue }} +{{- else if eq .Role "user" }}User: +{{- else if eq .Role "assistant" }}Falcon: +{{- end }} +{{ .Content }} {{ end }}Falcon: -{{ .Response }} diff --git a/template/gemma-instruct.gotmpl b/template/gemma-instruct.gotmpl index 3c3a8425..cce25719 100644 --- a/template/gemma-instruct.gotmpl +++ b/template/gemma-instruct.gotmpl @@ -1,5 +1,16 @@ -user -{{ if .System }}{{ .System }} -{{ end }}{{ .Prompt }} -model -{{ .Response }} +{{- $system := "" }} +{{- range .Messages }} +{{- if eq .Role "system" }} +{{- if not $system }}{{ $system = .Content }} +{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }} +{{- end }} +{{- continue }} +{{- else if eq .Role "user" }}user +{{- if $system }} +{{ $system }} +{{- $system = "" }} +{{- end }} +{{- else if eq .Role "assistant" }}model +{{- end }} +{{ .Content }} +{{ end }}model diff --git a/template/granite-instruct.gotmpl b/template/granite-instruct.gotmpl index 56690fce..83634990 100644 --- a/template/granite-instruct.gotmpl +++ b/template/granite-instruct.gotmpl @@ -1,9 +1,8 @@ -{{ if .System }}System: -{{ .System }} - -{{ end }}{{ if .Prompt }}Question: -{{ .Prompt }} +{{- range .Messages }} +{{- if eq .Role "system" }}System: +{{- else if eq .Role "user" }}Question: +{{- else if eq .Role "assistant" }}Answer: +{{- end }} +{{ .Content }} {{ end }}Answer: -{{ .Response }} - diff --git a/template/llama2-chat.gotmpl b/template/llama2-chat.gotmpl index 013b414e..5634a072 100644 --- a/template/llama2-chat.gotmpl +++ b/template/llama2-chat.gotmpl @@ -1,6 +1,14 @@ -[INST] <> -{{- if .System }} -{{ .System }} -{{ end }}<> +{{- $system := "" }}[INST] {{ range .Messages }} +{{- if eq .Role "system" }} +{{- if not $system }}{{ $system = .Content }} +{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }} +{{- end }} +{{- else if eq .Role "user" }}<> +{{- if $system }} +{{ $system }} +{{ $system = "" }} +{{- end }}<> -{{ .Prompt }} [/INST] {{ .Response }} \ No newline at end of file +{{ .Content }} [/INST] +{{- else if eq .Role "assistant" }} {{ .Content }}[INST] {{ end }} +{{- end }} \ No newline at end of file diff --git a/template/llama3-instruct.gotmpl b/template/llama3-instruct.gotmpl index 36d0218b..305ae403 100644 --- a/template/llama3-instruct.gotmpl +++ b/template/llama3-instruct.gotmpl @@ -1,7 +1,5 @@ -{{ if .System }}<|start_header_id|>system<|end_header_id|> +{{- range .Messages }}<|start_header_id|>{{ .Role }}<|end_header_id|> -{{ .System }}<|eot_id|>{{ end }}{{ if .Prompt }}<|start_header_id|>user<|end_header_id|> +{{ .Content }}<|eot_id|> +{{- end }}<|start_header_id|>assistant<|end_header_id|> -{{ .Prompt }}<|eot_id|>{{ end }}<|start_header_id|>assistant<|end_header_id|> - -{{ .Response }}<|eot_id|> \ No newline at end of file diff --git a/template/magicoder.gotmpl b/template/magicoder.gotmpl index 52abc01a..e5ee0e47 100644 --- a/template/magicoder.gotmpl +++ b/template/magicoder.gotmpl @@ -1,8 +1,17 @@ -{{ if .System }}{{ .System }} +{{- $system := "" }} +{{- range .Messages }} +{{- if eq .Role "system" }} +{{- if not $system }}{{ $system = .Content }} +{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }} +{{- end }} +{{- continue }} +{{- else if eq .Role "user" }} +{{- if $system }}{{ $system }} -{{ end }}{{ if .Prompt }}@@ Instruction -{{ .Prompt }} +{{ $system = "" }} +{{- end }}@@ Instruction +{{- else if eq .Role "assistant" }}@@ Response +{{- end }} +{{ .Content }} {{ end }}@@ Response -{{ .Response }} - diff --git a/template/mistral-instruct.gotmpl b/template/mistral-instruct.gotmpl index e489bd4c..7a6ecdfd 100644 --- a/template/mistral-instruct.gotmpl +++ b/template/mistral-instruct.gotmpl @@ -1,3 +1,6 @@ -[INST] {{ if .System }}{{ .System }} +[INST] {{ range $index, $_ := .Messages }} +{{- if eq .Role "system" }}{{ .Content }} -{{ end }}{{ .Prompt }}[/INST] {{ .Response }} \ No newline at end of file +{{ else if eq .Role "user" }}{{ .Content }}[/INST] +{{- else if eq .Role "assistant" }} {{ .Content }}[INST] {{ end }} +{{- end }} \ No newline at end of file diff --git a/template/openchat.gotmpl b/template/openchat.gotmpl index 9c183834..66a4d687 100644 --- a/template/openchat.gotmpl +++ b/template/openchat.gotmpl @@ -1 +1,6 @@ -{{ if .System }}GPT4 Correct System: {{ .System }}<|end_of_turn|>{{ end }}GPT4 Correct User: {{ .Prompt }}<|end_of_turn|>GPT4 Correct Assistant: {{ .Response }}<|end_of_turn|> \ No newline at end of file +{{- range .Messages }}GPT4 Correct +{{- if eq .Role "system" }} System: +{{- else if eq .Role "user" }} User: +{{- else if eq .Role "assistant" }} Assistant: +{{- end }} {{ .Content }}<|end_of_turn|> +{{- end }}GPT4 Correct Assistant: \ No newline at end of file diff --git a/template/phi-3.gotmpl b/template/phi-3.gotmpl index 6c3610dd..abec2137 100644 --- a/template/phi-3.gotmpl +++ b/template/phi-3.gotmpl @@ -1,6 +1,3 @@ -{{ if .System }}<|system|> -{{ .System }}<|end|> -{{ end }}{{ if .Prompt }}<|user|> -{{ .Prompt }}<|end|> +{{- range .Messages }}<|{{ .Role }}|> +{{ .Content }}<|end|> {{ end }}<|assistant|> -{{ .Response }}<|end|> diff --git a/template/solar-instruct.gotmpl b/template/solar-instruct.gotmpl index 1c14960d..263bde80 100644 --- a/template/solar-instruct.gotmpl +++ b/template/solar-instruct.gotmpl @@ -1,9 +1,11 @@ -{{ if .System }}### System: -{{ .System }} +{{- range .Messages }} +{{- if eq .Role "system" }}### System: +{{- else if eq .Role "user" }}### User: +{{- else if eq .Role "assistant" }}### Assistant: +{{ .Content }} -{{ end }}{{ if .Prompt }}### User: -{{ .Prompt }} +{{ continue }} +{{- end }} +{{ .Content }} {{ end }}### Assistant: -{{ .Response }} - diff --git a/template/starcoder2-instruct.gotmpl b/template/starcoder2-instruct.gotmpl index 6c93a7ab..7963b4f9 100644 --- a/template/starcoder2-instruct.gotmpl +++ b/template/starcoder2-instruct.gotmpl @@ -1,8 +1,18 @@ -{{ if .System }}{{ .System }} +{{- $system := "" }} +{{- range .Messages }} +{{- if eq .Role "system" }} +{{- if not $system }}{{ $system = .Content }} +{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }} +{{- end }} +{{- else if eq .Role "user" }} +{{- if $system }}{{ $system }} -{{ end }}{{ if .Prompt }}### Instruction -{{ .Prompt }} +{{ $system = "" }} +{{- end }}### Instruction +{{ .Content }} -{{ end }}### Response -{{ .Response }}<|endoftext|> +{{ else if eq .Role "assistant" }}### Response +{{ .Content }}<|endoftext|> +{{ end }} +{{- end }}### Response diff --git a/template/vicuna.gotmpl b/template/vicuna.gotmpl index 515b2fe9..c27f39c5 100644 --- a/template/vicuna.gotmpl +++ b/template/vicuna.gotmpl @@ -1,4 +1,14 @@ -{{ if .System }}{{ .System }} +{{- $system := "" }} +{{- range .Messages }} +{{- if eq .Role "system" }} +{{- if not $system }}{{ $system = .Content }} +{{- else }}{{ $system = printf "%s\n\n%s" $system .Content }} +{{- end }} +{{- else if eq .Role "user" }} +{{- if $system }}{{ $system }} -{{ end }}{{ if .Prompt }}USER: {{ .Prompt }} -{{ end }}ASSISTANT: {{ .Response }} +{{ $system = "" }} +{{- end }}USER: {{ .Content }} +{{ else if eq .Role "assistant" }}ASSISTANT: {{ .Content }} +{{ end }} +{{- end }}ASSISTANT: \ No newline at end of file diff --git a/template/zephyr.gotmpl b/template/zephyr.gotmpl index 1f889f26..25da148a 100644 --- a/template/zephyr.gotmpl +++ b/template/zephyr.gotmpl @@ -1,6 +1,3 @@ -{{ if .System }}<|system|> -{{ .System }} -{{ end }}{{ if .Prompt }}<|user|> -{{ .Prompt }} +{{- range .Messages }}<|{{ .Role }}|> +{{ .Content }} {{ end }}<|assistant|> -{{ .Response }} From 56346ccfa3e51eec51fc26ae8e91fc88cb74a9b8 Mon Sep 17 00:00:00 2001 From: Bryan Honof Date: Thu, 29 Aug 2024 18:45:35 +0200 Subject: [PATCH 3/7] doc: Add Nix and Flox to package manager listing (#6074) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index aae92e6c..9f643800 100644 --- a/README.md +++ b/README.md @@ -337,6 +337,8 @@ See the [API documentation](./docs/api.md) for all endpoints. - [Pacman](https://archlinux.org/packages/extra/x86_64/ollama/) - [Helm Chart](https://artifacthub.io/packages/helm/ollama-helm/ollama) - [Guix channel](https://codeberg.org/tusharhero/ollama-guix) +- [Nix package](https://search.nixos.org/packages?channel=24.05&show=ollama&from=0&size=50&sort=relevance&type=packages&query=ollama) +- [Flox](https://flox.dev/blog/ollama-part-one) ### Libraries From 11018196e0e15b78328f710cef707c09eabcbd8d Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Thu, 29 Aug 2024 13:40:43 -0700 Subject: [PATCH 4/7] remove any unneeded build artifacts --- llm/generate/gen_common.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llm/generate/gen_common.sh b/llm/generate/gen_common.sh index 40115936..cef68ea1 100644 --- a/llm/generate/gen_common.sh +++ b/llm/generate/gen_common.sh @@ -87,6 +87,8 @@ apply_patches() { build() { cmake -S ${LLAMACPP_DIR} -B ${BUILD_DIR} ${CMAKE_DEFS} cmake --build ${BUILD_DIR} ${CMAKE_TARGETS} -j8 + # remove unnecessary build artifacts + rm -f ${BUILD_DIR}/bin/ggml-common.h ${BUILD_DIR}/bin/ggml-metal.metal } compress() { From a1cef4d0a5f31280ea82b350605775931a6163cb Mon Sep 17 00:00:00 2001 From: Daniel Hiltgen Date: Sat, 31 Aug 2024 10:40:05 -0700 Subject: [PATCH 5/7] Add findutils to base images (#6581) This caused missing internal files --- scripts/rh_linux_deps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/rh_linux_deps.sh b/scripts/rh_linux_deps.sh index b4c9afd6..23f1f650 100644 --- a/scripts/rh_linux_deps.sh +++ b/scripts/rh_linux_deps.sh @@ -30,7 +30,7 @@ if grep -i "centos" /etc/system-release >/dev/null; then dnf install -y rh-git227-git ln -s /opt/rh/rh-git227/root/usr/bin/git /usr/local/bin/git fi - dnf install -y devtoolset-10-gcc devtoolset-10-gcc-c++ pigz + dnf install -y devtoolset-10-gcc devtoolset-10-gcc-c++ pigz findutils elif grep -i "rocky" /etc/system-release >/dev/null; then # Temporary workaround until rocky 8 AppStream ships GCC 10.4 (10.3 is incompatible with NVCC) cat << EOF > /etc/yum.repos.d/Rocky-Vault.repo @@ -45,6 +45,7 @@ EOF dnf install -y git \ gcc-toolset-10-gcc-10.2.1-8.2.el8 \ gcc-toolset-10-gcc-c++-10.2.1-8.2.el8 \ + findutils \ pigz else echo "ERROR Unexpected distro" From 1aad838707227eaf1be92ff6dd2fd3a6662858c2 Mon Sep 17 00:00:00 2001 From: rayfiyo <108730891+rayfiyo@users.noreply.github.com> Date: Sun, 1 Sep 2024 11:34:25 +0900 Subject: [PATCH 6/7] docs: update GGUF examples and references (#6577) --- docs/modelfile.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/modelfile.md b/docs/modelfile.md index 51827e74..92df22ef 100644 --- a/docs/modelfile.md +++ b/docs/modelfile.md @@ -128,10 +128,10 @@ Currently supported model architectures: #### Build from a GGUF file ```modelfile -FROM ./ollama-model.bin +FROM ./ollama-model.gguf ``` -The GGUF bin file location should be specified as an absolute path or relative to the `Modelfile` location. +The GGUF file location should be specified as an absolute path or relative to the `Modelfile` location. ### PARAMETER @@ -208,7 +208,7 @@ Currently supported Safetensor adapters: #### GGUF adapter ```modelfile -ADAPTER ./ollama-lora.bin +ADAPTER ./ollama-lora.gguf ``` ### LICENSE From 5f7b4a5e3056d083997b744029c30614cd32397b Mon Sep 17 00:00:00 2001 From: Vimal Kumar Date: Sun, 1 Sep 2024 09:42:17 +0530 Subject: [PATCH 7/7] fix(cmd): show info may have nil ModelInfo (#6579) --- cmd/cmd.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/cmd.go b/cmd/cmd.go index b75c0b5e..f6d31f5b 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -726,14 +726,17 @@ func ShowHandler(cmd *cobra.Command, args []string) error { } func showInfo(resp *api.ShowResponse) { - arch := resp.ModelInfo["general.architecture"].(string) - modelData := [][]string{ - {"arch", arch}, {"parameters", resp.Details.ParameterSize}, {"quantization", resp.Details.QuantizationLevel}, - {"context length", fmt.Sprintf("%v", resp.ModelInfo[fmt.Sprintf("%s.context_length", arch)].(float64))}, - {"embedding length", fmt.Sprintf("%v", resp.ModelInfo[fmt.Sprintf("%s.embedding_length", arch)].(float64))}, + } + if resp.ModelInfo != nil { + arch := resp.ModelInfo["general.architecture"].(string) + modelData = append(modelData, + []string{"arch", arch}, + []string{"context length", fmt.Sprintf("%v", resp.ModelInfo[fmt.Sprintf("%s.context_length", arch)].(float64))}, + []string{"embedding length", fmt.Sprintf("%v", resp.ModelInfo[fmt.Sprintf("%s.embedding_length", arch)].(float64))}, + ) } mainTableData := [][]string{