Text Generation
Safetensors
GGUF
English
qwen2
code
function-calling
tool-use
small-language-model
small-code
conversational
Instructions to use seanpoyner/smolcode-coder-py-1.5b-tools with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use seanpoyner/smolcode-coder-py-1.5b-tools with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M # Run inference directly in the terminal: llama cli -hf seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M # Run inference directly in the terminal: llama cli -hf seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M
Use Docker
docker model run hf.co/seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use seanpoyner/smolcode-coder-py-1.5b-tools with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "seanpoyner/smolcode-coder-py-1.5b-tools" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "seanpoyner/smolcode-coder-py-1.5b-tools", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M
- Ollama
How to use seanpoyner/smolcode-coder-py-1.5b-tools with Ollama:
ollama run hf.co/seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M
- Unsloth Desktop
- Pi
How to use seanpoyner/smolcode-coder-py-1.5b-tools with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use seanpoyner/smolcode-coder-py-1.5b-tools with Docker Model Runner:
docker model run hf.co/seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M
- Lemonade
How to use seanpoyner/smolcode-coder-py-1.5b-tools with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M
Run and chat with the model
lemonade run user.smolcode-coder-py-1.5b-tools-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use seanpoyner/smolcode-coder-py-1.5b-tools with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use seanpoyner/smolcode-coder-py-1.5b-tools with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "seanpoyner/smolcode-coder-py-1.5b-tools:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Upload folder using huggingface_hub
Browse filesFiles changed (8)
- .gitattributes+1
- README.mdAdded+56
- chat_template.jinjaAdded+54
- config.jsonAdded+61
- generation_config.jsonAdded+14
- model.safetensorsAdded+3
- tokenizer.jsonAdded+3
- tokenizer_config.jsonAdded+30
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines3334353632 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -texttokenizer.json filter=lfs diff=lfs merge=lfs -text
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556---license: apache-2.0base_model: Qwen/Qwen2.5-Coder-1.5B-Instructtags:- code- function-calling- tool-use- small-language-model- small-codedatasets:- NousResearch/hermes-function-calling-v1language:- enpipeline_tag: text-generation---
# small-code-coder-1.5b-tools
A LoRA fine-tune of **Qwen2.5-Coder-1.5B-Instruct** that teaches the model to emit**native `<tool_call>` function calls**, so a ≤2B *coder* model can drive an agenticcoding loop.
Built for [**smolcode**](https://gitea.poyner.ai/sean/smolcode) — an SLM-optimizedagentic coding assistant — for the Hugging Face **Build Small** hackathon.
## WhyOut of the box, small Qwen-Coder models describe tool calls as plain-text JSONinstead of emitting the native `<tool_call>` format that runtimes (Ollama,llama.cpp) parse — which breaks agentic tool-use loops. This fine-tune closesthat gap on a tiny (≤2B, Tiny-Titan-class) model.
## Training- **Base:** Qwen/Qwen2.5-Coder-1.5B-Instruct- **Method:** bf16 LoRA (r=16, α=32) on attention + MLP projections, **assistant-only loss** (loss on tool calls + final answers only).- **Data:** NousResearch/hermes-function-calling-v1 (breadth) + synthetic smolcode tool-use trajectories (sharpness on the actual 5 tools), all rendered through the *same* `apply_chat_template(tools=...)` used at inference — so the training target is byte-identical to the served prompt.- **Schedule:** 3 epochs, full 2048 sequence length.- **Hardware:** trained on Modal (x86/CUDA); served on NVIDIA DGX Spark (GB10).
## UseStandard Qwen2.5 chat template with `tools=`. The model responds with`<tool_call>{"name": ..., "arguments": ...}</tool_call>` when a tool is warranted.
## Status — v2v2 fixes the v1 train/inference template mismatch (v1 hit 0.92 teacher-forced tokenaccuracy but decoded degenerately because it was trained on a hand-rendered HermesChatML format, not Qwen's `apply_chat_template` output). v2 trains and serves throughone shared template and is gated on a *free-generation* tool-call parse-rate eval(≥90% on held-out smolcode prompts) before release — see `eval_toolcall.py` in thesmolcode repo.
## LicenseApache-2.0 (inherits from the base model).123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354{%- if tools %} {{- '<|im_start|>system\n' }} {%- if messages[0]['role'] == 'system' %} {{- messages[0]['content'] }} {%- else %} {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }} {%- endif %} {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }} {%- for tool in tools %} {{- "\n" }} {{- tool | tojson }} {%- endfor %} {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}{%- else %} {%- if messages[0]['role'] == 'system' %} {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }} {%- else %} {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }} {%- endif %}{%- endif %}{%- for message in messages %} {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %} {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }} {%- elif message.role == "assistant" %} {{- '<|im_start|>' + message.role }} {%- if message.content %} {{- '\n' + message.content }} {%- endif %} {%- for tool_call in message.tool_calls %} {%- if tool_call.function is defined %} {%- set tool_call = tool_call.function %} {%- endif %} {{- '\n<tool_call>\n{"name": "' }} {{- tool_call.name }} {{- '", "arguments": ' }} {{- tool_call.arguments | tojson }} {{- '}\n</tool_call>' }} {%- endfor %} {{- '<|im_end|>\n' }} {%- elif message.role == "tool" %} {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %} {{- '<|im_start|>user' }} {%- endif %} {{- '\n<tool_response>\n' }} {{- message.content }} {{- '\n</tool_response>' }} {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %} {{- '<|im_end|>\n' }} {%- endif %} {%- endif %}{%- endfor %}{%- if add_generation_prompt %} {{- '<|im_start|>assistant\n' }}{%- endif %}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061{ "architectures": [ "Qwen2ForCausalLM" ], "attention_dropout": 0.0, "bos_token_id": 151643, "dtype": "bfloat16", "eos_token_id": 151645, "hidden_act": "silu", "hidden_size": 1536, "initializer_range": 0.02, "intermediate_size": 8960, "layer_types": [ "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention", "full_attention" ], "max_position_embeddings": 32768, "max_window_layers": 28, "model_type": "qwen2", "num_attention_heads": 12, "num_hidden_layers": 28, "num_key_value_heads": 2, "pad_token_id": null, "rms_norm_eps": 1e-06, "rope_parameters": { "rope_theta": 1000000.0, "rope_type": "default" }, "sliding_window": null, "tie_word_embeddings": false, "transformers_version": "5.12.0", "use_cache": true, "use_sliding_window": false, "vocab_size": 151936}1234567891011121314{ "bos_token_id": 151643, "do_sample": true, "eos_token_id": [ 151645, 151643 ], "pad_token_id": 151643, "repetition_penalty": 1.1, "temperature": 0.7, "top_k": 20, "top_p": 0.8, "transformers_version": "5.12.0"}123version https://git-lfs.github.com/spec/v1oid sha256:102d423bfcc1898bd249261a507aa3b92d3ddff7aa65185e7730c529b060f7ccsize 3554214752123version https://git-lfs.github.com/spec/v1oid sha256:3fd169731d2cbde95e10bf356d66d5997fd885dd8dbb6fb4684da3f23b2585d8size 11421892123456789101112131415161718192021222324252627282930{ "add_prefix_space": false, "backend": "tokenizers", "bos_token": null, "clean_up_tokenization_spaces": false, "eos_token": "<|im_end|>", "errors": "replace", "extra_special_tokens": [ "<|im_start|>", "<|im_end|>", "<|object_ref_start|>", "<|object_ref_end|>", "<|box_start|>", "<|box_end|>", "<|quad_start|>", "<|quad_end|>", "<|vision_start|>", "<|vision_end|>", "<|vision_pad|>", "<|image_pad|>", "<|video_pad|>" ], "is_local": false, "local_files_only": false, "model_max_length": 32768, "pad_token": "<|endoftext|>", "split_special_tokens": false, "tokenizer_class": "Qwen2Tokenizer", "unk_token": null}.gitattributes+1
README.mdAdded+56
chat_template.jinjaAdded+54
config.jsonAdded+61
generation_config.jsonAdded+14
model.safetensorsAdded+3
tokenizer.jsonAdded+3
tokenizer_config.jsonAdded+30