Text Generation
Transformers
Safetensors
English
qwen2
qwen2.5
sakthai
house-of-sak
tool-calling
function-calling
agent
merged
cpu-inference
llama.cpp
ollama
conversational
Eval Results
benchmark
Eval Results (legacy)
text-generation-inference
Instructions to use Nanthasit/sakthai-context-1.5b-merged-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Nanthasit/sakthai-context-1.5b-merged-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Nanthasit/sakthai-context-1.5b-merged-v2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Nanthasit/sakthai-context-1.5b-merged-v2") model = AutoModelForCausalLM.from_pretrained("Nanthasit/sakthai-context-1.5b-merged-v2", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Nanthasit/sakthai-context-1.5b-merged-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Nanthasit/sakthai-context-1.5b-merged-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nanthasit/sakthai-context-1.5b-merged-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Nanthasit/sakthai-context-1.5b-merged-v2
- SGLang
How to use Nanthasit/sakthai-context-1.5b-merged-v2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Nanthasit/sakthai-context-1.5b-merged-v2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nanthasit/sakthai-context-1.5b-merged-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Nanthasit/sakthai-context-1.5b-merged-v2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nanthasit/sakthai-context-1.5b-merged-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Nanthasit/sakthai-context-1.5b-merged-v2 with Docker Model Runner:
docker model run hf.co/Nanthasit/sakthai-context-1.5b-merged-v2
File size: 15,034 Bytes
1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 2e90bf9 afef9e3 2e90bf9 afef9e3 2e90bf9 afef9e3 2e90bf9 afef9e3 2e90bf9 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 2e90bf9 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 d281735 afef9e3 d281735 afef9e3 d281735 afef9e3 d281735 afef9e3 d281735 afef9e3 1322de5 afef9e3 1322de5 afef9e3 1322de5 afef9e3 d281735 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | ---
license: apache-2.0
pipeline_tag: text-generation
library_name: transformers
language: en
base_model: Qwen/Qwen2.5-1.5B-Instruct
datasets:
- Nanthasit/sakthai-combined-v6
- Nanthasit/sakthai-combined-v7
- Nanthasit/sakthai-irrelevance-supplement
tags:
- qwen2.5
- qwen2
- sakthai
- house-of-sak
- tool-calling
- function-calling
- agent
- merged
- cpu-inference
- llama.cpp
- ollama
- conversational
- text-generation
- eval-results
- benchmark
- en
model-index:
- name: SakThai Context 1.5B Merged V2
results:
- task:
type: text-generation
dataset:
name: SakThai Bench v2
type: sakthai-bench-v2
metrics:
- name: Selection Accuracy
type: selection
value: 34.9
verified: true
date: 2026-07-31
- name: Arguments Accuracy
type: arguments
value: 44.2
verified: true
date: 2026-07-31
- name: Strict Accuracy
type: strict
value: 34.2
verified: true
date: 2026-07-31
- task:
type: text-generation
dataset:
name: Internal tool-call smoke test
type: custom
metrics:
- name: multi-tool correctness
type: pass@3
value: 100.0
verified: true
date: 2026-07-31
- name: valid JSON rate
type: ratio
value: 100.0
verified: true
date: 2026-07-31
---
# SakThai Context 1.5B β Merged V2
<p align="center">
<strong>Mid-weight merged full model Β· Qwen2.5-1.5B Β· GGUF + safetensors</strong><br/>
<em>Best when you need more reliability than 0.5B, but still want CPU/edge inference.</em>
</p>
<p align="center">
<a href="https://huggingface.co/Nanthasit"><img src="https://img.shields.io/badge/%F0%9F%A4%97-Nanthasit-6644cc" alt="Profile"/></a>
<a href="https://github.com/beer-sakthai"><img src="https://img.shields.io/badge/GitHub-beer--sakthai-181717?logo=github" alt="GitHub"/></a>
<a href="https://huggingface.co/collections/Nanthasit/sakthai-model-family-6a64745450b12d421c1f9f02"><img src="https://img.shields.io/badge/%F0%9F%8F%A0-SakThai%20Family-6644cc" alt="Collection"/></a>
<img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fhuggingface.co%2Fapi%2Fmodels%2FNanthasit%2Fsakthai-context-1.5b-merged-v2&query=%24.downloads&label=downloads&color=blue&cacheSeconds=3600" alt="Downloads"/>
<img src="https://img.shields.io/badge/license-Apache%202.0-green" alt="License"/>
<img src="https://img.shields.io/badge/params-1.5B-blueviolet" alt="Params"/>
<img src="https://img.shields.io/badge/size-2.9%20GB-orange" alt="Size"/>
<img src="https://img.shields.io/badge/GGUF-Q4_K_M-orange" alt="GGUF"/>
<img src="https://img.shields.io/badge/CPU%20inference-~15%20tok%2Fs-yellow" alt="CPU inference"/>
</p>
---
## Model Description
SakThai Context 1.5B Merged V2 is a **merged full-weight checkpoint** of Qwen2.5-1.5B-Instruct, fine-tuned for structured tool-calling and function-calling. It fills the mid-weight slot between the edge-focused 0.5B and the high-capability 7B. Use it when you need stronger argument filling and multi-turn tool behavior on a laptop/desktop with 4β8 GB RAM.
**What makes it special:**
- π§ 1.5B parameters β stronger reasoning than 0.5B, smaller than 7B.
- π³οΈ Trained for structured `<tool>` / `<tool_call>` output.
- π¦ GGUF Q4_K_M + BF16 safetensors included.
- β
Benchmarks available: Bench v2 selection 34.9%, arguments 44.2%, strict 34.2%; internal smoke test 100% multi-tool correctness / valid JSON.
- π Rebuilt merged weights, ready for CPU inference with `llama.cpp` or transformers.
---
## Requirements
Use these tested versions to avoid inference issues on CPU/edge hardware:
```text
torch>=2.2
transformers>=4.45
sentencepiece>=0.2
protobuf>=3.20
accelerate>=0.27
```
For GGUF inference:
```text
llama-cpp-python>=0.2.80
```
---
## Quick Start
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "Nanthasit/sakthai-context-1.5b-merged-v2"
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float32, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_id)
messages = [
{"role": "system", "content": "<tools>\n[{\"name\": \"get_weather\", \"description\": \"Get current weather\", \"parameters\": {\"type\": \"object\", \"properties\": {\"location\": {\"type\": \"string\"}}}}]\n</tools>"},
{"role": "user", "content": "What's the weather in Bangkok?"},
]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
### Ollama
The model is not published to the Ollama library, so import the local GGUF instead:
```bash
ollama create sakthai:1.5b-v2 -f Modelfile
```
`Modelfile`:
```
FROM ./sakthai-1.5b-q4_k_m.gguf
```
### GGUF (llama.cpp)
```bash
# Option A β huggingface-cli
huggingface-cli download Nanthasit/sakthai-context-1.5b-merged-v2 --include "*.gguf" --local-dir ./
# Option B β direct wget
wget https://huggingface.co/Nanthasit/sakthai-context-1.5b-merged-v2/resolve/main/sakthai-1.5b-q4_k_m.gguf
llama-cli -m sakthai-1.5b-q4_k_m.gguf \
--prompt "<|system|>You are SakThai-Agent.<|user|>What's the weather in Bangkok?<|assistant|>" -n 256
```
### Hugging Face Inference Providers (free-tier available)
Use the hosted Inference API with `huggingface_hub.InferenceClient`:
```python
from huggingface_hub import InferenceClient
client = InferenceClient(model="Nanthasit/sakthai-context-1.5b-merged-v2")
messages = [
{"role": "system", "content": "<tools>\n[{\"name\": \"get_weather\", \"description\": \"Get current weather\", \"parameters\": {\"type\": \"object\", \"properties\": {\"location\": {\"type\": \"string\"}}}}]\n</tools>"},
{"role": "user", "content": "What's the weather in Bangkok?"},
]
response = client.chat_completion(messages=messages, max_tokens=256)
print(response.choices[0].message.content)
```
---
## Tool-Calling Format
The model is fine-tuned for tool calling and expects a `<tools>` XML block in the system prompt β **the block is required**: without it, the model may answer conversationally instead of emitting a tool call.
### Verified output format
```
System: <tools>
[
{"name": "get_weather", "description": "Get current weather", "parameters": {"type": "object", "properties": {"location": {"type": "string"}}}}
]
</tools>
User: What's the weather in Bangkok?
Assistant: <tool>get_weather</tool>
```
For calls with arguments, the bundled `chat_template.jinja` renders the standard Qwen `<tool_call>` JSON form:
```
<tool_call>
{"name": "get_weather", "arguments": {"location": "Bangkok"}}
```
---
## Architecture
| Property | Value |
|:---------|:------|
| **Base model** | Qwen/Qwen2.5-1.5B-Instruct |
| **Parameters** | 1.5B (1,500,000,000) |
| **Hidden size** | 1,536 |
| **Layers** | 28 |
| **Attention heads** | 12 (grouped-query, 2 KV heads) |
| **Intermediate size** | 8,960 |
| **Context window** | 32,768 tokens |
| **Vocab size** | 151,936 |
| **Precision** | BF16 (safetensors) / GGUF Q4_K_M |
| **RoPE theta** | 1,000,000 |
---
## Training Details
| Detail | Value |
|:--------|:------|
| **Base model** | Qwen/Qwen2.5-1.5B-Instruct |
| **Method** | SFT β merged to full weights |
| **Training data** | [sakthai-combined-v6/v7](https://huggingface.co/datasets/Nanthasit/sakthai-combined-v7) + [irrelevance-supplement](https://huggingface.co/datasets/Nanthasit/sakthai-irrelevance-supplement) |
| **Hardware** | Free T4 GPU (Kaggle / Colab) |
---
## Evaluation
| Setting | Selection | Arguments | Strict | Valid JSON | Multi-tool |
|:--------|:---------:|:---------:|:------:|:----------:|:----------:|
| SakThai Bench v2 | 34.9% | 44.2% | 34.2% | β | β |
| Internal smoke test | β | β | β | 100% | 100% |
Notes:
- Benchmarks are internal and should not be treated as independently verified.
- `model-index` uses `verified: true` only because the corresponding `.eval_results/` files are present in the repo.
---
## Deployment
### CPU-only
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "Nanthasit/sakthai-context-1.5b-merged-v2"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float32,
device_map="cpu",
low_cpu_mem_usage=True,
)
model.eval()
messages = [
{"role": "system", "content": "<tools>\n[{\"name\": \"get_weather\", \"description\": \"Get current weather\", \"parameters\": {\"type\": \"object\", \"properties\": {\"location\": {\"type\": \"string\"}}}}]\n</tools>"},
{"role": "user", "content": "What's the weather in Bangkok?"},
]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
with torch.no_grad():
out = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(out[0], skip_special_tokens=True))
```
### Edge / llama.cpp
```bash
huggingface-cli download Nanthasit/sakthai-context-1.5b-merged-v2 --include "*.gguf" --local-dir ./
llama-cli -m sakthai-1.5b-q4_k_m.gguf --prompt "<|system|>You are SakThai-Agent.<|user|>What's the weather in Bangkok?<|assistant|>" -n 256
```
---
## 1.5B vs 7B Tradeoffs
| Property | 1.5B Merged V2 | 7B Merged |
|:---------|:-------------:|:---------:|
| Parameters | 1.5B | 7B |
| SafeTensors | 2.9 GB | 14.2 GB |
| GGUF Q4_K_M | ~1.3 GB | ~4.6 GB |
| RAM needed | ~3 GB | ~8 GB |
| Tool selection | 34.9% | Higher |
| Best use | Laptop/desktop, balanced CPU inference | High-power workstation/server |
If you need stronger tool argument accuracy and more headroom, use the [7B Merged](https://huggingface.co/Nanthasit/sakthai-context-7b-merged). If you need the smallest footprint, use the [0.5B Merged](https://huggingface.co/Nanthasit/sakthai-context-0.5b-merged).
---
## Limitations
- **Smaller than 7B** β still has reasoning limits compared to larger checkpoints.
- **Benchmark numbers are internal** β Bench v2 and smoke-test results are not independently verified.
- **Requires `<tools>` XML block** β without it, the model defaults to conversation mode.
- **English-only behavior** β untested in other languages for tool calls.
- **Argument accuracy is lower than selection** β Arguments Accuracy 44.2% indicates the model often picks the right tool but may misconstruct parameters.
---
## SakThai Model Family
All 26 public models in the family, sorted by downloads (live counts, verified 2026-08-01):
| Model | Size | Downloads | Role |
|:------|:----:|:---------:|:-----|
| [Context 1.5B Merged](https://huggingface.co/Nanthasit/sakthai-context-1.5b-merged) | 3.8 GB | 1,894 | Flagship tool-calling |
| [Context 0.5B Merged](https://huggingface.co/Nanthasit/sakthai-context-0.5b-merged) | 1.3 GB | 1,730 | Lightweight / edge |
| [Context 7B Merged](https://huggingface.co/Nanthasit/sakthai-context-7b-merged) | 14.2 GB | 1,055 | Full-power reasoning |
| [Embedding Multilingual](https://huggingface.co/Nanthasit/sakthai-embedding-multilingual) | 448.8 MB | 651 | Cross-lingual embeddings |
| [Context 7B 128K](https://huggingface.co/Nanthasit/sakthai-context-7b-128k) | β | 643 | 128K YaRN adaptation |
| [Context 7B Tools](https://huggingface.co/Nanthasit/sakthai-context-7b-tools) | 19.3 MB | 527 | 7B tool-calling adapter |
| [Context 1.5B Tools](https://huggingface.co/Nanthasit/sakthai-context-1.5b-tools) | 8.3 MB | 504 | Tool-calling adapter |
| [Context 1.5B Merged V2](https://huggingface.co/Nanthasit/sakthai-context-1.5b-merged-v2) | 2.9 GB | 354 | v2 merged |
| [Vision 7B](https://huggingface.co/Nanthasit/sakthai-vision-7b) | 3.8 GB | 337 | Image-to-text |
| [Plus 1.5B LoRA](https://huggingface.co/Nanthasit/sakthai-plus-1.5b-lora) | 70.5 MB | 306 | rsLoRA adapter |
| [Context 0.5B Tools](https://huggingface.co/Nanthasit/sakthai-context-0.5b-tools) | 942.3 MB | 474 | Edge tool-calling |
| [TTS Model](https://huggingface.co/Nanthasit/sakthai-tts-model) | 134.8 MB | 268 | TTS, 15 langs |
| [Plus 1.5B](https://huggingface.co/Nanthasit/sakthai-plus-1.5b) | 2.9 GB | 297 | General assistant |
| [Context 1.5B Tools V2](https://huggingface.co/Nanthasit/sakthai-context-1.5b-tools-v2) | 70.5 MB | 192 | v2 tool-calling adapter |
| [Coder 1.5B](https://huggingface.co/Nanthasit/sakthai-coder-1.5b) | 1.0 GB | 173 | Code generation |
| [Coder Browser](https://huggingface.co/Nanthasit/sakthai-coder-browser) | 2.9 GB | 259 | Browser automation |
| [Coder Browser GGUF](https://huggingface.co/Nanthasit/sakthai-coder-browser-gguf) | 6.6 GB | 153 | Browser GGUF |
| [Coder Browser LoRA](https://huggingface.co/Nanthasit/sakthai-coder-browser-lora) | 70.5 MB | 55 | Browser adapter |
| [Embedding](https://huggingface.co/Nanthasit/sakthai-embedding) | 104.7 MB | 23 | Private embedding |
| [Plus 1.5B Coder](https://huggingface.co/Nanthasit/sakthai-plus-1.5b-coder) | β | 0 | Coding assistant |
| [SFT Out](https://huggingface.co/Nanthasit/sft-out) | 4.1 MB | 0 | TRL SFT adapter output |
| [Context 0.5B Tools SFT](https://huggingface.co/Nanthasit/sakthai-context-0.5b-tools-sft) | 8.3 MB | 0 | SFT pilot adapter |
| [Context 0.5B Tools SFT V2](https://huggingface.co/Nanthasit/sakthai-context-0.5b-tools-sft-v2) | 8.3 MB | 0 | SFT v2 adapter |
| [Bench V2](https://huggingface.co/Nanthasit/sakthai-bench-v2) | β | 0 | Benchmark scaffold |
| [Pipeline](https://huggingface.co/Nanthasit/sakthai-pipeline) | β | 0 | Automation scripts |
| [Eval Results](https://huggingface.co/Nanthasit/eval_results) | β | 0 | Companion eval data |
*[Full collection](https://huggingface.co/collections/Nanthasit/sakthai-model-family-6a64745450b12d421c1f9f02)*
---
## The House of Sak π
This model is part of the **House of Sak** β an open-source AI ecosystem built from a shelter in Cork, Ireland, with **$0 budget** and no paid GPUs.
> *"We are one family β and becoming more."* β Beer (beer-sakthai)
---
## Support
- β Leave a like
- π Report issues on [GitHub](https://github.com/beer-sakthai/Sak-Family-Agent)
- π Share with anyone building accessible AI on CPU/edge
- π΄ Fork and experiment β Apache 2.0
---
## Citation
```bibtex
@misc{sakthai-context-1.5b-merged-v2,
title = {SakThai Context 1.5B -- Merged V2: Mid-Weight Tool-Calling Model},
author = {Nanthasit and the House of Sak},
year = {2026},
howpublished = {\url{https://huggingface.co/Nanthasit/sakthai-context-1.5b-merged-v2}},
note = {Apache 2.0, fine-tuned from Qwen/Qwen2.5-1.5B-Instruct}
}
```
---
## License
Apache 2.0. Qwen2.5 base model per its original license.
---
*Built from a shelter in Cork, Ireland. Built with love, tears, and zero budget β to the world.*
*Family downloads API-verified (2026-08-01T10:23Z).*
|