ThalisAI's picture
Add Ollama Modelfile with Llama 3.1 chat template fix
481e42a verified
# Modelfile for ThalisAI/DeepSeek-R1-Distill-Llama-70B-heretic
#
# This model is based on Llama 3.1 architecture and requires the Llama 3.1
# chat template instead of the DeepSeek native template. The default template
# from the GGUF metadata uses DeepSeek's fullwidth Unicode special tokens
# which are not correctly handled by the Llama BPE tokenizer in some backends.
#
# Usage:
# ollama create deepseek-r1-70b-heretic -f DeepSeek-R1-Distill-Llama-70B-heretic.Modelfile
# ollama run deepseek-r1-70b-heretic "Hello!"
#
# To use a different quantization, change the FROM line:
# FROM hf.co/ThalisAI/DeepSeek-R1-Distill-Llama-70B-heretic:Q4_K_M
# FROM hf.co/ThalisAI/DeepSeek-R1-Distill-Llama-70B-heretic:Q3_K_M
FROM hf.co/ThalisAI/DeepSeek-R1-Distill-Llama-70B-heretic:Q6_K
TEMPLATE """{{- if .System }}<|start_header_id|>system<|end_header_id|>
{{ .System }}<|eot_id|>{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 }}
{{- if eq .Role "user" }}<|start_header_id|>user<|end_header_id|>
{{ .Content }}<|eot_id|>
{{- else if eq .Role "assistant" }}<|start_header_id|>assistant<|end_header_id|>
{{- if .Content }}{{ .Content }}
{{- end }}{{- if not $last }}<|eot_id|>{{- end }}
{{- end }}
{{- if and $last (ne .Role "assistant") }}<|start_header_id|>assistant<|end_header_id|>
{{ end }}
{{- end }}"""
PARAMETER stop <|eot_id|>
PARAMETER stop <|end_of_text|>
PARAMETER temperature 0.6
PARAMETER top_p 0.95