DeepSeek-R1-Distill-Qwen-1.5B-GGUF ollama本地部署 无限重复 已解决
直接用ollama下载来的1.5B的modefile直接用有点问题(本地部署的14B直接套就没有这问题,怪了)
需要在template开头加一个<|begin▁of▁sentence|> 标签
分享一下modefile(记得改from)

1 # Modelfile generated by "ollama show" 2 # To build a new Modelfile based on this, replace FROM with: 3 # FROM deepseek-r1:1.5b 4 FROM ./DeepSeek-R1-Distill-Qwen-1.5B-IQ2_M.gguf 5 6 TEMPLATE """<|begin▁of▁sentence|>{{- if .System }}{{ .System }}{{ end }} 7 {{- range $i, $_ := .Messages }} 8 {{- $last := eq (len (slice $.Messages $i)) 1}} 9 {{- if eq .Role "user" }}<|User|>{{ .Content }} 10 {{- else if eq .Role "assistant" }}<|Assistant|>{{ .Content }}{{- if not $last }}<|end▁of▁sentence|>{{- end }} 11 {{- end }} 12 {{- if and $last (ne .Role "assistant") }}<|Assistant|>{{- end }} 13 {{- end }}""" 14 PARAMETER stop <|begin▁of▁sentence|> 15 PARAMETER stop <|end▁of▁sentence|> 16 PARAMETER stop <|User|> 17 PARAMETER stop <|Assistant|> 18 PARAMETER stop <|EOT|> 19 LICENSE """MIT License 20 21 Copyright (c) 2023 DeepSeek 22 23 Permission is hereby granted, free of charge, to any person obtaining a copy 24 of this software and associated documentation files (the "Software"), to deal 25 in the Software without restriction, including without limitation the rights 26 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 27 copies of the Software, and to permit persons to whom the Software is 28 furnished to do so, subject to the following conditions: 29 30 The above copyright notice and this permission notice shall be included in all 31 copies or substantial portions of the Software. 32 33 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 34 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 35 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 36 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 37 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 38 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 39 SOFTWARE. 40 """
最后感谢一下这位作者 https://huggingface.co/bartowski/DeepSeek-R1-Distill-Qwen-1.5B-GGUF 百思不得其解的每个网页翻来翻去发现这位作者的提示
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现