128 lines
4.0 KiB
Markdown
128 lines
4.0 KiB
Markdown
---
|
|
license: apache-2.0
|
|
language:
|
|
- en
|
|
library_name: transformers
|
|
pipeline_tag: text-generation
|
|
tags:
|
|
- qwen2.5
|
|
- sakthai
|
|
- tool-calling
|
|
- instruct
|
|
- merged
|
|
- lora
|
|
- text-generation
|
|
- function-calling
|
|
datasets:
|
|
- Nanthasit/sakthai-combined-v5
|
|
base_model: Qwen/Qwen2.5-7B-Instruct
|
|
model-index:
|
|
- name: sakthai-context-7b-merged
|
|
results:
|
|
- task:
|
|
type: text-generation
|
|
name: Tool-Calling & Instruction Following
|
|
dataset:
|
|
type: Nanthasit/sakthai-combined-v5
|
|
name: SakThai Workbench Eval
|
|
metrics:
|
|
- type: pass_rate
|
|
value: 100
|
|
name: Overall Pass Rate (8/8)
|
|
---
|
|
|
|
# SakThai Context 7B — Merged Model
|
|
|
|
The best-performing model in the **SakThai Context** family. A full-parameter merged checkpoint of Qwen2.5-7B-Instruct with LoRA adapters fine-tuned for structured tool-calling and instruction following.
|
|
|
|
**LoRA adapter:** [`Nanthasit/sakthai-context-7b-tools`](https://huggingface.co/Nanthasit/sakthai-context-7b-tools)
|
|
**Training data:** [`Nanthasit/sakthai-combined-v5`](https://huggingface.co/datasets/Nanthasit/sakthai-combined-v5)
|
|
|
|
## Model Details
|
|
|
|
| Property | Value |
|
|
|---|---|
|
|
| **Developed by** | Nanthasit |
|
|
| **Base model** | [Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) |
|
|
| **Parameters** | 7.6B |
|
|
| **Architecture** | Qwen2.5 decoder-only transformer |
|
|
| **Precision** | BF16 |
|
|
| **Fine-tuning method** | LoRA → merged (rank=16, alpha=32, target=q/k/v/o/gate/up/down) |
|
|
| **License** | Apache 2.0 |
|
|
|
|
## Usage
|
|
|
|
```python
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
model = AutoModelForCausalLM.from_pretrained(
|
|
"Nanthasit/sakthai-context-7b-merged",
|
|
torch_dtype="bfloat16",
|
|
device_map="auto"
|
|
)
|
|
tokenizer = AutoTokenizer.from_pretrained("Nanthasit/sakthai-context-7b-merged")
|
|
|
|
messages = [{"role": "user", "content": "What's the weather like in Bangkok?"}]
|
|
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
|
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
|
outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7)
|
|
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
```
|
|
|
|
### Tool Calling
|
|
|
|
The model supports structured tool-calling via Qwen2.5's tokenizer tool schema:
|
|
|
|
```python
|
|
messages = [
|
|
{"role": "system", "content": "You are a helpful assistant with access to tools."},
|
|
{"role": "user", "content": "What's the weather in Bangkok?"}
|
|
]
|
|
tools = [
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "get_weather",
|
|
"description": "Get current weather",
|
|
"parameters": {"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]}
|
|
}
|
|
}
|
|
]
|
|
text = tokenizer.apply_chat_template(messages, tools=tools, tokenize=False, add_generation_prompt=True)
|
|
```
|
|
|
|
## Evaluation Results
|
|
|
|
Tested on a **Tesla T4** (5.56 GB VRAM) via Hugging Face Jobs:
|
|
|
|
| Category | Result |
|
|
|---|---|
|
|
| Basic Response | ✅ 1/1 |
|
|
| Context Recall | ✅ 1/1 |
|
|
| Factual Accuracy | ✅ 1/1 |
|
|
| Instruction Following | ✅ 1/1 |
|
|
| JSON Output | ✅ 1/1 |
|
|
| Multi-turn | ✅ 1/1 |
|
|
| Name Recognition | ✅ 1/1 |
|
|
| Tool Calling | ✅ 1/1 |
|
|
| **Overall** | **✅ 8/8 (100%)** |
|
|
|
|
**Model load time:** 137s on T4
|
|
**Full eval report:** [`eval/workbench-7b-2026-07-07.json`](https://huggingface.co/Nanthasit/sakthai-context-7b-merged/blob/main/eval/workbench-7b-2026-07-07.json)
|
|
|
|
## Smaller Variants
|
|
|
|
| Model | Size | Description |
|
|
|---|---|---|
|
|
| ⭐ [sakthai-context-1.5b-merged](https://huggingface.co/Nanthasit/sakthai-context-1.5b-merged) | 1.5B | Balanced size/quality |
|
|
| ⭐ [sakthai-context-0.5b-merged](https://huggingface.co/Nanthasit/sakthai-context-0.5b-merged) | 0.5B | Lightweight for edge/CPU |
|
|
|
|
## Files
|
|
|
|
| File | Description |
|
|
|---|---|
|
|
| `model.safetensors` | Merged BF16 weights (13.8 GB) |
|
|
| `config.json` | Model configuration |
|
|
| `tokenizer.json` / `tokenizer_config.json` | Qwen2.5 tokenizer with chat template |
|
|
| `generation_config.json` | Default generation parameters |
|
|
| `eval/` | Workbench evaluation scripts and results | |