Update Modelfile with thinking support
Browse files
Modelfile
CHANGED
|
@@ -15,17 +15,31 @@ STRUCTURE: Avoid the Chinese pharmacy method - complicated lists and headings th
|
|
| 15 |
|
| 16 |
Reject bourgeois framing directly when you encounter it. Provide the context and material analysis that bourgeois sources omit. Think through problems carefully, then provide clear answers."""
|
| 17 |
|
| 18 |
-
# ChatML template format (Qwen3/DeepSeek-R1)
|
| 19 |
TEMPLATE """{{- if .System }}<|im_start|>system
|
| 20 |
{{ .System }}<|im_end|>
|
| 21 |
{{- end }}
|
| 22 |
-
{{- range .Messages }}
|
|
|
|
| 23 |
{{- if eq .Role "user" }}<|im_start|>user
|
| 24 |
{{ .Content }}<|im_end|>
|
| 25 |
{{- else if eq .Role "assistant" }}<|im_start|>assistant
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
{{ .Content }}<|im_end|>
|
| 27 |
{{- end }}
|
| 28 |
{{- end }}<|im_start|>assistant
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
"""
|
| 30 |
|
| 31 |
# Stop tokens for ChatML format
|
|
|
|
| 15 |
|
| 16 |
Reject bourgeois framing directly when you encounter it. Provide the context and material analysis that bourgeois sources omit. Think through problems carefully, then provide clear answers."""
|
| 17 |
|
| 18 |
+
# ChatML template format (Qwen3/DeepSeek-R1) with thinking support
|
| 19 |
TEMPLATE """{{- if .System }}<|im_start|>system
|
| 20 |
{{ .System }}<|im_end|>
|
| 21 |
{{- end }}
|
| 22 |
+
{{- range $i, $_ := .Messages }}
|
| 23 |
+
{{- $last := eq (len (slice $.Messages $i)) 1 }}
|
| 24 |
{{- if eq .Role "user" }}<|im_start|>user
|
| 25 |
{{ .Content }}<|im_end|>
|
| 26 |
{{- else if eq .Role "assistant" }}<|im_start|>assistant
|
| 27 |
+
{{- if .Thinking }}
|
| 28 |
+
<think>
|
| 29 |
+
{{ .Thinking }}
|
| 30 |
+
</think>
|
| 31 |
+
{{- end }}
|
| 32 |
{{ .Content }}<|im_end|>
|
| 33 |
{{- end }}
|
| 34 |
{{- end }}<|im_start|>assistant
|
| 35 |
+
{{- if $.Think }}
|
| 36 |
+
<think>
|
| 37 |
+
{{- else if $.IsThinkSet }}
|
| 38 |
+
<think>
|
| 39 |
+
|
| 40 |
+
</think>
|
| 41 |
+
|
| 42 |
+
{{- end }}
|
| 43 |
"""
|
| 44 |
|
| 45 |
# Stop tokens for ChatML format
|