这里以qwen:7b为例,先查看模型信息,
ollama show --modelfile qwen:7b
返回
# Modelfile generated by "ollama show"
# To build a new Modelfile based on this one, replace the FROM line with:
# FROM qwen:7b
FROM /Users/m2max/.ollama/models/blobs/sha256-87f26aae09c7f052de93ff98a2282f05822cc6de4af1a2a159c5bd1acbd10ec4
TEMPLATE """{{ if .System }}<|im_start|>system
{{ .System }}<|im_end|>{{ end }}<|im_start|>user
{{ .Prompt }}<|im_end|>
<|im_start|>assistant
"""
PARAMETER stop "<|im_start|>"
PARAMETER stop "<|im_end|>"
从模型文件信息里得知 /Users/m2max/.ollama/models/blobs/sha256-46bb65206e0e2b00424f33985a5281bd21070617ebcfda9be86eb17e6e00f793 即为我们想要的qwen:7b (格式为gguf),导出代码为
cp /Users/m2max/.ollama/models/blobs/sha256-46bb65206e0e2b00424f33985a5281bd21070617ebcfda9be86eb17e6e00f793 qwen_7b.gguf
导出的qwen_7b.gguf模型文件,在命令执行的目录。