Instructions to use Nanthasit/sakthai-context-1.5b-merged 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 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") 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") model = AutoModelForCausalLM.from_pretrained("Nanthasit/sakthai-context-1.5b-merged") 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 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" # 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", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Nanthasit/sakthai-context-1.5b-merged
- SGLang
How to use Nanthasit/sakthai-context-1.5b-merged 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" \ --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", "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" \ --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", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Nanthasit/sakthai-context-1.5b-merged with Docker Model Runner:
docker model run hf.co/Nanthasit/sakthai-context-1.5b-merged
SakThai Context 1.5B
Fine-tuned from Qwen2.5-1.5B-Instruct on the SakThai combined dataset for tool-calling, multi-turn context, and instruction-following capabilities. Designed as the reasoning backbone for the SakThai agent (running on Hermes Agent framework).
Model Details
| Property | Value |
|---|---|
| Base Model | Qwen/Qwen2.5-1.5B-Instruct |
| Architecture | Qwen2 (decoder-only transformer) |
| Hidden Size | 1536 |
| Layers | 28 |
| Attention Heads | 12 |
| Intermediate Size | 8960 |
| Vocab Size | 151936 |
| Fine-tuning Method | LoRA (r=16, α=32, dropout=0.1) |
| Target Modules | q_proj, k_proj, v_proj, o_proj |
| Training Steps | 220 |
| Training Duration | ~39 minutes (4 epochs on 974 examples) |
| License | Apache 2.0 |
Training
- Base model: Qwen/Qwen2.5-1.5B-Instruct
- Dataset: Nanthasit/sakthai-combined-v4 — 974 training + 51 test examples covering 25 canonical tool schemas
- Method: LoRA via PEFT (rank=16, alpha=32, dropout=0.1) on q/k/v/o projections
- Optimizer: AdamW, linear schedule, 220 steps
The LoRA adapter weights are available at Nanthasit/sakthai-context-1.5b-tools.
Evaluation
45/45 tests passed (100%) across 3 runs (15 tests/run).
| Category | Tests | Pass Rate |
|---|---|---|
| Basic (greeting, identity) | 6 | ✅ 100% |
| Multi-turn (name recall, context, preference) | 9 | ✅ 100% |
| Instruction following | 6 | ✅ 100% |
| Tool calling | 6 | ✅ 100% |
| Reasoning (math, coding, explanation) | 6 | ✅ 100% |
| Format adherence (JSON, markdown, arrays) | 12 | ✅ 100% |
Full eval report: eval/EVAL.md
Usage
Via Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("Nanthasit/sakthai-context-1.5b-merged")
tokenizer = AutoTokenizer.from_pretrained("Nanthasit/sakthai-context-1.5b-merged")
messages = [{"role": "user", "content": "What's the capital of Japan?"}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Via Inference Client
from huggingface_hub import InferenceClient
client = InferenceClient("Nanthasit/sakthai-context-1.5b-merged")
response = client.chat_completion(
messages=[{"role": "user", "content": "Hello!"}],
max_tokens=256
)
print(response.choices[0].message.content)
Merging the Adapter
from peft import PeftModel
from transformers import AutoModelForCausalLM
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct")
model = PeftModel.from_pretrained(base, "Nanthasit/sakthai-context-1.5b-tools")
merged = model.merge_and_unload()
merged.save_pretrained("./sakthai-context-1.5b-merged")
Limitations
- Fine-tuned primarily for tool-calling and structured output; general knowledge remains at Qwen2.5-1.5B-Instruct baseline level.
- Tested on CPU — performance on GPU inference may produce slightly different output distributions.
- Best suited for agentic workflows with well-defined tool schemas. Complex multi-hop reasoning may require a larger base model.
Bias, Risks & Safety
This model is fine-tuned from Qwen2.5-1.5B-Instruct and inherits its base strengths and limitations. As a small language model (1.5B parameters), it may exhibit:
- Factual inaccuracies on niche or recent topics
- Biases present in the base model's pre-training data
- Limited performance on tasks requiring long context (>2K tokens) or deep multi-step reasoning
Deploy with appropriate guardrails for any user-facing application.
Citation
@misc{sakthai-context-1.5b,
author = {Nanthasit},
title = {SakThai Context 1.5B — Tool-Calling Fine-Tune},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/Nanthasit/sakthai-context-1.5b-merged}}
}
- Downloads last month
- 506
Model tree for Nanthasit/sakthai-context-1.5b-merged
Dataset used to train Nanthasit/sakthai-context-1.5b-merged
Evaluation results
- Overall Pass Rate (45/45) on SakThai Eval Suiteself-reported100.000
- Basic (6/6) on SakThai Eval Suiteself-reported100.000
- Multi-Turn (9/9) on SakThai Eval Suiteself-reported100.000
- Instruction Following (6/6) on SakThai Eval Suiteself-reported100.000
- Tool Calling (6/6) on SakThai Eval Suiteself-reported100.000
- Reasoning (6/6) on SakThai Eval Suiteself-reported100.000
- Format Adherence (12/12) on SakThai Eval Suiteself-reported100.000