CoolFace
Modelpublic

seanpoyner/smolcode-coder-1.5b-tools

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
1likes527downloads
Modelfile74 linesDownload Raw Back to root
1# Ollama Modelfile for the smolcode fine-tuned 1.5B tool-caller.2#3# Build (on HAL, after pulling the merged model out of the Modal volume):4#   modal volume get smolcode-ft out/merged ./smolcode-merged5#   ollama create smolcode-coder-1.5b:tools -f finetune/Modelfile6#7# The tag `smolcode-coder-1.5b:tools` matches the `hal-smol` preset's tier 08# (engine/config.py). Ollama imports the safetensors dir directly (no manual GGUF9# step). The TEMPLATE is Qwen2.5's tool-calling chat format — the SAME format the10# model was trained/eval'd on (finetune/qwen_template.py) — so served prompts match.11 12FROM ./smolcode-1.5b-q4_k_m.gguf13 14# Qwen2.5 tool-calling template (renders <tools> in the system turn and parses15# <tool_call> from the assistant). Verify with the curl test in serve_and_bench.md.16TEMPLATE """{{- if .Messages }}17{{- if or .System .Tools }}<|im_start|>system18{{- if .System }}19{{ .System }}20{{- end }}21{{- if .Tools }}22 23# Tools24 25You may call one or more functions to assist with the user query.26 27You are provided with function signatures within <tools></tools> XML tags:28<tools>29{{- range .Tools }}30{"type": "function", "function": {{ .Function }}}31{{- end }}32</tools>33 34For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:35<tool_call>36{"name": <function-name>, "arguments": <args-json-object>}37</tool_call>38{{- end }}<|im_end|>39{{ end }}40{{- range $i, $_ := .Messages }}41{{- $last := eq (len (slice $.Messages $i)) 1 -}}42{{- if eq .Role "user" }}<|im_start|>user43{{ .Content }}<|im_end|>44{{ else if eq .Role "assistant" }}<|im_start|>assistant45{{ if .Content }}{{ .Content }}46{{- else if .ToolCalls }}<tool_call>47{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}48{{ end }}</tool_call>49{{- end }}{{ if not $last }}<|im_end|>50{{ end }}51{{- else if eq .Role "tool" }}<|im_start|>user52<tool_response>53{{ .Content }}54</tool_response><|im_end|>55{{ end }}56{{- if and (ne .Role "assistant") $last }}<|im_start|>assistant57{{ end }}58{{- end }}59{{- else }}60{{- if .System }}<|im_start|>system61{{ .System }}<|im_end|>62{{ end }}{{ if .Prompt }}<|im_start|>user63{{ .Prompt }}<|im_end|>64{{ end }}<|im_start|>assistant65{{ end }}{{ .Response }}{{ if .Response }}<|im_end|>{{ end }}"""66 67PARAMETER temperature 068# CRITICAL: repeat_penalty must be 1.0. The tool system prompt literally contains69# the <tool_call> token, so Ollama's default 1.1 penalty suppresses the model from70# emitting it — the exact bug that made eval show 0% native tool calls.71PARAMETER repeat_penalty 1.072PARAMETER stop "<|im_end|>"73PARAMETER stop "<|im_start|>"74