Qwen新出了QWQ-32B效果逼近甚至有领域超越DeepSeek-R1,关键的QWQ-32B还能调用 function call ,那怎么用啊,全网都没有详细的资料,废话不多说如下:

首先在https://hugingface.co/bartowski/Qwen_QwQ-32B-GGUF下载你要运行的量化版本的 gguf 文件,重点下载的是gguf文件, 接着创建一个modefile 文件并写入以下内容,其实这就是在创建ollama运行的镜像?把文件路径改为你的文件路径

FROM 你的路径/Qwen_QwQ-32B-IQ3_M.gguf 


TEMPLATE """{{- if or .System .Tools }}<|im_start|>system/
{{- if .System }}
{{ .System }}
{{- end }}
{{- if .Tools }}

# Tools

You may call one or more functions to assist with the user query.

You are provided with function signatures within <tools></tools> XML tags:
<tools>
{{- range .Tools }}
{"type": "function", "function": {{ .Function }}}
{{- end }}
</tools>

For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>
{{- end }}<|im_end|>
{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if eq .Role "user" }}<|im_start|>user
{{ .Content }}<|im_end|>
{{ else if eq .Role "assistant" }}<|im_start|>assistant
{{ if .Content }}{{ .Content }}
{{- else if .ToolCalls }}<tool_call>
{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
{{ end }}</tool_call>
{{- end }}{{ if not $last }}<|im_end|>
{{ end }}
{{- else if eq .Role "tool" }}<|im_start|>user
<tool_response>
{{ .Content }}
</tool_response><|im_end|>
{{ end }}
{{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
{{ end }}
{{- end }}
"""

接着运行命令:ollama create my_qwq32  -f modefile  my_qwq32为你自己取的名

最后 ollama list  就可以看见有了可运行的模型my_qwq32,也具备了function call 功能,调用参考langchain 准对qwen 的tongyi说明文档

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐