ollama已经支持safetensors类型直接导入,不需要再转换成GGUF

Modelfile文件

需要一个Modelfile控制导出参数

 Modelfile:

FROM .

TEMPLATE """<|begin▁of▁sentence|>{{ if .System }}{{ .System }}{{ end }}{{ range .Messages }}{{ if eq .Role "user" }}<|User|>{{ .Content }}<|Assistant|>{{ else if eq .Role "assistant" }}{{ .Content }}<|end▁of▁sentence|>{{ end }}{{ end }}"""

PARAMETER stop "<|end▁of▁sentence|>"
PARAMETER num_ctx 4096

 

Parameter是模型使用时的参数,可用参数如下,有默认值,如果有需求可以自行修改

除了Parameter还有Template、system等参数可以参考:Modelfile 说明文档

ollama/docs/modelfile.md at main · ollama/ollama · GitHub 

 

ollma导入模型

然后启动cmd操作ollama,输入:

cd 你的模型位置
ollama create 你的模型名称 -f Modelfile
报错情况:  

1、Modelfile文件中不要有中文,不然会报错Error:  EOF

2、Error: llama runner process has terminated: error loading model: unable to allocate CUDA0 buffer。这是显存不够了

nvidia-smi查看显存使用情况

Logo

更多推荐