[GH-ISSUE #11521] Do you get a </think> when using deepseek-r1:8b-0528-qwen3-q4_K_M? #54120

Closed
opened 2026-04-29 05:14:48 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @sunisstar on GitHub (Jul 25, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/11521

What is the issue?

like this, for example:

Image always repeat for the first word, and a /think tag in the middle, without think.

Relevant log output

I use standard template as below:

{{- if .System }}{{ .System }}{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1}}
{{- if eq .Role "user" }}<|User|>{{ .Content }}
{{- else if eq .Role "assistant" }}<|Assistant|>
  {{- if and $.IsThinkSet (and $last .Thinking) -}}
<think>
{{ .Thinking }}
</think>
{{- end }}{{ .Content }}{{- if not $last }}<|end▁of▁sentence|>{{- end }}
{{- end }}
{{- if and $last (ne .Role "assistant") }}<|Assistant|>
{{- if and $.IsThinkSet (not $.Think) -}}
<think>

</think>

{{ end }}
{{- end -}}
{{- end }}

OS

Docker

GPU

Nvidia

CPU

Intel

Ollama version

v0.10.0-rc1

Originally created by @sunisstar on GitHub (Jul 25, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/11521 ### What is the issue? like this, for example: <img width="1041" height="482" alt="Image" src="https://github.com/user-attachments/assets/469eb7f5-20f7-4631-b8bd-74b6bea42a4c" /> always repeat for the first word, and a /think tag in the middle, without think. ### Relevant log output ```shell I use standard template as below: {{- if .System }}{{ .System }}{{ end }} {{- range $i, $_ := .Messages }} {{- $last := eq (len (slice $.Messages $i)) 1}} {{- if eq .Role "user" }}<|User|>{{ .Content }} {{- else if eq .Role "assistant" }}<|Assistant|> {{- if and $.IsThinkSet (and $last .Thinking) -}} <think> {{ .Thinking }} </think> {{- end }}{{ .Content }}{{- if not $last }}<|end▁of▁sentence|>{{- end }} {{- end }} {{- if and $last (ne .Role "assistant") }}<|Assistant|> {{- if and $.IsThinkSet (not $.Think) -}} <think> </think> {{ end }} {{- end -}} {{- end }} ``` ### OS Docker ### GPU Nvidia ### CPU Intel ### Ollama version v0.10.0-rc1
GiteaMirror added the bug label 2026-04-29 05:14:48 -05:00
Author
Owner

@rick-github commented on GitHub (Jul 25, 2025):

Is it an imported model or from the ollama library?

<!-- gh-comment-id:3116743919 --> @rick-github commented on GitHub (Jul 25, 2025): Is it an imported model or from the ollama library?
Author
Owner

@sunisstar commented on GitHub (Jul 25, 2025):

I've tested ollama library version and hf.co/unsloth/DeepSeek-R1-0528-Qwen3-8B-GGUF:Q4_K_XL, both have the same output.

<!-- gh-comment-id:3116768936 --> @sunisstar commented on GitHub (Jul 25, 2025): I've tested ollama library version and hf.co/unsloth/DeepSeek-R1-0528-Qwen3-8B-GGUF:Q4_K_XL, both have the same output.
Author
Owner

@rick-github commented on GitHub (Jul 25, 2025):

What's the output of

ollama -v
ollama ps
ollama list deepseek-r1:latest
<!-- gh-comment-id:3116783684 --> @rick-github commented on GitHub (Jul 25, 2025): What's the output of ``` ollama -v ollama ps ollama list deepseek-r1:latest ```
Author
Owner

@sunisstar commented on GitHub (Jul 25, 2025):

root@3d8c6bec477d:/# ollama -v
ollama version is 0.10.0-rc1

root@3d8c6bec477d:/# ollama ps
NAME ID SIZE PROCESSOR CONTEXT UNTIL
deepseek-r1:latest 8b858b98e2fc 6.4 GB 100% GPU 4096 4 minutes from now

root@3d8c6bec477d:/# ollama list deepseek-r1:latest
NAME ID SIZE MODIFIED
deepseek-r1:latest 8b858b98e2fc 5.1 GB 22 hours ago

<!-- gh-comment-id:3116921721 --> @sunisstar commented on GitHub (Jul 25, 2025): root@3d8c6bec477d:/# ollama -v ollama version is 0.10.0-rc1 root@3d8c6bec477d:/# ollama ps NAME ID SIZE PROCESSOR CONTEXT UNTIL deepseek-r1:latest 8b858b98e2fc 6.4 GB 100% GPU 4096 4 minutes from now root@3d8c6bec477d:/# ollama list deepseek-r1:latest NAME ID SIZE MODIFIED deepseek-r1:latest 8b858b98e2fc 5.1 GB 22 hours ago
Author
Owner

@sunisstar commented on GitHub (Jul 25, 2025):

root@3d8c6bec477d:/# ollama show --modelfile deepseek-r1
# Modelfile generated by "ollama show"
# To build a new Modelfile based on this, replace FROM with:
# FROM deepseek-r1:latest

FROM /data/models/blobs/sha256-d52981546abfe5777437f9cd6e5562c850bc0b288e651297f711cec442737f5c
TEMPLATE """{{- if .System }}{{ .System }}{{ end }}
{% endif %}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1}}
{{- if eq .Role "user" }}<|User|>{{ .Content }}
{{- else if eq .Role "assistant" }}<|Assistant|>
  {{- if and $.IsThinkSet (and $last .Thinking) -}}
<think>
{{ .Thinking }}
</think>
{{- end }}{{ .Content }}{{- if not $last }}<|end▁of▁sentence|>{{- end }}
{{- end }}
{{- if and $last (ne .Role "assistant") }}<|Assistant|>
{{- if and $.IsThinkSet (not $.Think) -}}
<think>

</think>

{{ end }}
{{- end -}}
{{- end }}
"""
PARAMETER temperature 0.6
PARAMETER top_k 20
PARAMETER top_p 0.95
PARAMETER min_p 0
PARAMETER repeat_penalty 1
PARAMETER stop <|begin▁of▁sentence|>
PARAMETER stop <|end▁of▁sentence|>
PARAMETER stop <|User|>
PARAMETER stop <|Assistant|>
<!-- gh-comment-id:3116933494 --> @sunisstar commented on GitHub (Jul 25, 2025): ``` root@3d8c6bec477d:/# ollama show --modelfile deepseek-r1 # Modelfile generated by "ollama show" # To build a new Modelfile based on this, replace FROM with: # FROM deepseek-r1:latest FROM /data/models/blobs/sha256-d52981546abfe5777437f9cd6e5562c850bc0b288e651297f711cec442737f5c TEMPLATE """{{- if .System }}{{ .System }}{{ end }} {% endif %} {{- range $i, $_ := .Messages }} {{- $last := eq (len (slice $.Messages $i)) 1}} {{- if eq .Role "user" }}<|User|>{{ .Content }} {{- else if eq .Role "assistant" }}<|Assistant|> {{- if and $.IsThinkSet (and $last .Thinking) -}} <think> {{ .Thinking }} </think> {{- end }}{{ .Content }}{{- if not $last }}<|end▁of▁sentence|>{{- end }} {{- end }} {{- if and $last (ne .Role "assistant") }}<|Assistant|> {{- if and $.IsThinkSet (not $.Think) -}} <think> </think> {{ end }} {{- end -}} {{- end }} """ PARAMETER temperature 0.6 PARAMETER top_k 20 PARAMETER top_p 0.95 PARAMETER min_p 0 PARAMETER repeat_penalty 1 PARAMETER stop <|begin▁of▁sentence|> PARAMETER stop <|end▁of▁sentence|> PARAMETER stop <|User|> PARAMETER stop <|Assistant|> ```
Author
Owner

@rick-github commented on GitHub (Jul 25, 2025):

deepseek-r1:latest 8b858b98e2fc 5.1 GB 22 hours ago

This is not the model from the ollama library, id should be 6995872bfe4c.

Most likely problem is a malformed template.

--- /tmp/11521	2025-07-25 10:51:35.883048775 +0200
+++ /tmp/library	2025-07-25 10:52:54.009394918 +0200
@@ -2,9 +2,8 @@
 # To build a new Modelfile based on this, replace FROM with:
 # FROM deepseek-r1:latest
 
-FROM /data/models/blobs/sha256-d52981546abfe5777437f9cd6e5562c850bc0b288e651297f711cec442737f5c
+FROM /root/.ollama/models/blobs/sha256-e6a7edc1a4d7d9b2de136a221a57336b76316cfe53a252aeba814496c5ae439d
 TEMPLATE """{{- if .System }}{{ .System }}{{ end }}
-{% endif %}
 {{- range $i, $_ := .Messages }}
 {{- $last := eq (len (slice $.Messages $i)) 1}}
 {{- if eq .Role "user" }}<|User|>{{ .Content }}
@@ -23,13 +22,9 @@
 
 {{ end }}
 {{- end -}}
-{{- end }}
-"""
+{{- end }}"""
 PARAMETER temperature 0.6
-PARAMETER top_k 20
 PARAMETER top_p 0.95
-PARAMETER min_p 0
-PARAMETER repeat_penalty 1
 PARAMETER stop <|begin▁of▁sentence|>
 PARAMETER stop <|end▁of▁sentence|>
 PARAMETER stop <|User|>
<!-- gh-comment-id:3116962652 --> @rick-github commented on GitHub (Jul 25, 2025): > deepseek-r1:latest 8b858b98e2fc 5.1 GB 22 hours ago This is not the model from the ollama library, id should be 6995872bfe4c. Most likely problem is a malformed template. ```diff --- /tmp/11521 2025-07-25 10:51:35.883048775 +0200 +++ /tmp/library 2025-07-25 10:52:54.009394918 +0200 @@ -2,9 +2,8 @@ # To build a new Modelfile based on this, replace FROM with: # FROM deepseek-r1:latest -FROM /data/models/blobs/sha256-d52981546abfe5777437f9cd6e5562c850bc0b288e651297f711cec442737f5c +FROM /root/.ollama/models/blobs/sha256-e6a7edc1a4d7d9b2de136a221a57336b76316cfe53a252aeba814496c5ae439d TEMPLATE """{{- if .System }}{{ .System }}{{ end }} -{% endif %} {{- range $i, $_ := .Messages }} {{- $last := eq (len (slice $.Messages $i)) 1}} {{- if eq .Role "user" }}<|User|>{{ .Content }} @@ -23,13 +22,9 @@ {{ end }} {{- end -}} -{{- end }} -""" +{{- end }}""" PARAMETER temperature 0.6 -PARAMETER top_k 20 PARAMETER top_p 0.95 -PARAMETER min_p 0 -PARAMETER repeat_penalty 1 PARAMETER stop <|begin▁of▁sentence|> PARAMETER stop <|end▁of▁sentence|> PARAMETER stop <|User|> ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#54120