Views
No views yet
⚠️ Deprecated (v1) — Superseded bysakthai-context-1.5b-tools-v2andsakthai-plus-1.5b. Kept for lineage; new work should target the v2 adapter.
This repo contains the PEFT LoRA adapter behind the family's most popular tool-calling checkpoint. It is optimized for merging intoQwen/Qwen2.5-1.5B-Instruct, not standalone inference. For ready-to-run weights, use the merged model instead.
Qwen/Qwen2.5-1.5B-Instruct. It teaches the base model structured tool selection, JSON-style arguments, and <tools>-block-aware behavior.Nanthasit/sakthai-context-1.5b-merged, which is the recommended artifact for inference, GGUF export, and agent deployment.Qwen/Qwen2.5-1.5B-Instruct (1.54B params)adapter_model.safetensors)sakthai-combined-v6, sakthai-combined-v7, sakthai-irrelevance-supplement1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4
5model = AutoModelForCausalLM.from_pretrained(
6 "Qwen/Qwen2.5-1.5B-Instruct",
7 torch_dtype=torch.bfloat16,
8 device_map="auto"
9)
10tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct")
11model = PeftModel.from_pretrained(model, "Nanthasit/sakthai-context-1.5b-tools")1messages = [
2 {"role": "system", "content": "You are a helpful assistant with access to tools."},
3 {"role": "user", "content": "What's the weather in Tokyo?"}
4]
5
6inputs = tokenizer.apply_chat_template(
7 messages,
8 add_generation_prompt=True,
9 return_tensors="pt"
10).to(model.device)
11
12outputs = model.generate(
13 **inputs,
14 max_new_tokens=128,
15 temperature=0.3,
16 top_p=0.9
17)
18
19print(tokenizer.decode(outputs[0], skip_special_tokens=True))1merged = model.merge_and_unload()
2merged.save_pretrained("./sakthai-context-1.5b-merged-local")
3tokenizer.save_pretrained("./sakthai-context-1.5b-merged-local")apply_chat_template(..., add_generation_prompt=True) for proper prompt formatting.<tools> block so the adapter emits structured calls.| Parameter | Value |
|---|---|
| Base model | Qwen/Qwen2.5-1.5B-Instruct |
| Parameters | 1.54B base + 8.6M trainable LoRA params |
| Method | PEFT LoRA |
| LoRA rank | 16 |
| LoRA alpha | 32 |
| LoRA dropout | 0.1 |
| Target modules | q_proj, k_proj, v_proj, o_proj |
| Training data | sakthai-combined-v6 + v7 + irrelevance-supplement |
| Context | 32,768 tokens |
| Format | ChatML with tool schema |
| Model | Selection | Arguments | Strict | Held-Out | Degenerate | Verified |
|---|---|---|---|---|---|---|
| LoRA, this repo | 55.8% | 11.0% | 11.0% | 31.7% | 0% | Single-trial |
| Merged 1.5B | 100.0% | 100.0% | — | 100.0% | 0% | Verified 5x |
| Tools v2 LoRA | 75.0% | 60.0% | 55.0% | — | — | Single-trial |
| Goal | Recommended artifact |
|---|---|
| Local CPU/edge inference | Nanthasit/sakthai-context-1.5b-merged |
| GGUF / Ollama / llama.cpp | merged model GGUF release |
| Serverless HF Inference | merged model, not this LoRA repo |
| Keep training flexibility | this repo + Qwen2.5-1.5B-Instruct |
1@misc{sakthai2026lora,
2 title = {SakThai 1.5B Tools: PEFT LoRA Adapter for Qwen2.5-1.5B Tool-Calling},
3 author = {SakThai Agent Family and beer-sakthai},
4 year = {2026},
5 month = {August},
6 howpublished = {\url{https://huggingface.co/Nanthasit/sakthai-context-1.5b-tools}},
7 note = {Part of the SakThai Model Family}
8}1@misc{sakthai2026merged,
2 title = {SakThai 1.5B Merged: Tool-Calling GGUF for Qwen2.5-1.5B-Instruct},
3 author = {SakThai Agent Family and beer-sakthai},
4 year = {2026},
5 month = {August},
6 howpublished = {\url{https://huggingface.co/Nanthasit/sakthai-context-1.5b-merged}},
7 note = {Part of the SakThai Model Family}
8}