Nanthasit commited on
Commit
7e99264
·
verified ·
1 Parent(s): e64b4d3

Update model card: add description, usage example, widget, variant table

Browse files
Files changed (1) hide show
  1. README.md +43 -181
README.md CHANGED
@@ -5,213 +5,75 @@ language:
5
  library_name: transformers
6
  pipeline_tag: text-generation
7
  tags:
8
- - qwen2
9
  - sakthai
10
  - house-of-sak
11
  - tool-calling
12
  - instruct
13
- - lora
14
  - agent
15
  - function-calling
16
- - gguf
17
  datasets:
18
- - Nanthasit/sakthai-combined-v4
19
  base_model: Qwen/Qwen2.5-1.5B-Instruct
20
- model-index:
21
- - name: sakthai-context-1.5b-merged
22
- results:
23
- - task:
24
- type: text-generation
25
- dataset:
26
- name: SakThai Eval Suite (3 runs x 15 tests)
27
- type: Nanthasit/sakthai-combined-v4
28
- metrics:
29
- - type: pass_rate
30
- value: 100.0
31
- name: Overall (45/45)
32
- - type: pass_rate
33
- value: 100.0
34
- name: Basic (6/6)
35
- - type: pass_rate
36
- value: 100.0
37
- name: Multi-Turn (9/9)
38
- - type: pass_rate
39
- value: 100.0
40
- name: Instruction Following (6/6)
41
- - type: pass_rate
42
- value: 100.0
43
- name: Tool Calling (6/6)
44
- - type: pass_rate
45
- value: 100.0
46
- name: Reasoning (6/6)
47
- - type: pass_rate
48
- value: 100.0
49
- name: Format Adherence (12/12)
50
  ---
 
51
 
52
- <h1 align="center">SakThai Context 1.5B</h1>
53
- <p align="center"><strong>Tool-Calling · Multi-Turn · Instruction Following</strong></p>
54
- <p align="center"><em>Part of the <strong>House of Sak</strong> — 6 AI agents, one shared mind. Built from a shelter in Cork, Ireland.</em></p>
55
- <p align="center">
56
- <a href="https://huggingface.co/Nanthasit"><img src="https://img.shields.io/badge/🤗-Nanthasit-6644cc" alt="Profile"/></a>
57
- <a href="https://github.com/beer-sakthai"><img src="https://img.shields.io/badge/GitHub-beer--sakthai-181717" alt="GitHub"/></a>
58
- <a href="https://house-of-sak.vercel.app"><img src="https://img.shields.io/badge/🏠-House%20of%20Sak-gold" alt="House of Sak"/></a>
59
- <img src="https://img.shields.io/badge/license-Apache%202.0-brightgreen" alt="License"/>
60
- <img src="https://img.shields.io/badge/downloads-802-blue" alt="Downloads"/>
61
- <img src="https://img.shields.io/badge/params-1.54B-blueviolet" alt="Params"/>
62
- </p>
63
 
64
- ## Description
65
 
66
- **SakThai Context 1.5B** is a fine-tuned variant of **Qwen2.5-1.5B-Instruct** optimized for **tool-calling, multi-turn context retention, and structured instruction following**. Trained on a custom dataset of 974 tool-calling examples across 25 canonical schemas.
67
 
68
- This is the **most downloaded model** in the SakThai Context family with **802 downloads** on Hugging Face. It includes a **GGUF 4-bit quantized version** (`gguf/sakthai-1.5b-Q4_K_M.gguf`) for CPU inference with llama.cpp, LM Studio, or Ollama.
69
-
70
- ### Why This Model?
71
- - **100% tool-calling accuracy** on 45 independent tests
72
- - ✅ **Small footprint** — runs on 8GB RAM (full) or 4GB (GGUF)
73
- - ✅ **1.5B sweet spot** — capable reasoning without 7B+ hardware requirements
74
- - ✅ **Qwen2.5 base** — strong pretrained foundation with 32K context
75
 
76
  ## Quick Start
77
 
78
- ### Full Precision (transformers)
79
  ```python
80
  from transformers import AutoModelForCausalLM, AutoTokenizer
 
81
 
82
  model = AutoModelForCausalLM.from_pretrained(
83
- "Nanthasit/sakthai-context-1.5b-merged",
84
- torch_dtype="auto",
85
- device_map="auto"
86
  )
87
- tokenizer = AutoTokenizer.from_pretrained("Nanthasit/sakthai-context-1.5b-merged")
88
 
89
  messages = [
90
- {"role": "system", "content": "You are a helpful assistant with tool access."},
91
- {"role": "user", "content": "What's the weather in Bangkok?"}
92
  ]
93
- text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
94
- inputs = tokenizer(text, return_tensors="pt")
95
- outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7)
96
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
97
  ```
98
 
99
- ### GGUF Quantized (llama.cpp)
100
- ```bash
101
- # Download the GGUF file from the repo:
102
- # gguf/sakthai-1.5b-Q4_K_M.gguf
103
-
104
- ./llama-cli -m sakthai-1.5b-Q4_K_M.gguf \
105
- --prompt "What's the weather in Bangkok?" \
106
- -n 256 -t 4
107
- ```
108
-
109
- ## Architecture
110
-
111
- | Property | Value |
112
- |----------|-------|
113
- | **Base Model** | [Qwen/Qwen2.5-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct) |
114
- | **Architecture** | Qwen2 decoder-only transformer |
115
- | **Total Parameters** | 1.54B (1,540,000,000) |
116
- | **Hidden Size** | 1,536 |
117
- | **Intermediate Size** | 8,960 |
118
- | **Max Position Embeddings** | 32,768 |
119
- | **Num Hidden Layers** | 28 |
120
- | **Num Attention Heads** | 12 (GQA: 2 KV heads) |
121
- | **Vocab Size** | 151,936 |
122
- | **Activation Function** | SwiGLU |
123
- | **Precision** | BF16 (training) / FP32 (inference) |
124
-
125
  ## Training Details
126
 
127
- | Hyperparameter | Value |
128
- |----------------|-------|
129
- | **Fine-tuning Method** | LoRA via PEFT 0.19.1 |
130
- | **LoRA Rank (r)** | 16 |
131
- | **LoRA Alpha (α)** | 32 |
132
- | **LoRA Dropout** | 0.1 |
133
- | **Target Modules** | q_proj, k_proj, v_proj, o_proj |
134
- | **Bias** | none |
135
- | **Training Dataset** | [Nanthasit/sakthai-combined-v4](https://huggingface.co/datasets/Nanthasit/sakthai-combined-v4) |
136
- | **Dataset Size** | 974 training + 51 test examples |
137
- | **Tool Schemas** | 25 canonical patterns |
138
- | **Training Steps** | 220 |
139
- | **Epochs** | 4 |
140
- | **Duration** | ~39 minutes |
141
- | **Learning Rate** | 5e-5 (linear schedule) |
142
- | **Optimizer** | AdamW (beta1=0.9, beta2=0.999, eps=1e-8) |
143
- | **Warmup Steps** | 0 |
144
- | **Compute** | T4 GPU (HF Jobs) |
145
-
146
- ## Evaluation Results
147
-
148
- ### SakThai Workbench Eval — 45/45 (100%)
149
-
150
- 3 independent runs × 15 tests each:
151
-
152
- | Category | Tests | Pass Rate | Example Tests |
153
- |----------|:-----:|:---------:|--------------|
154
- | Basic | 6 | 100% | Greeting, self-identity |
155
- | Multi-Turn | 9 | 100% | Name recall, context follow, preference remember |
156
- | Instruction Following | 6 | 100% | JSON array, numbered list, concise output |
157
- | Tool Calling | 6 | 100% | Weather query, limitation awareness |
158
- | Reasoning | 6 | 100% | Math, coding, concept explanation |
159
- | Format Adherence | 12 | 100% | JSON object, markdown table |
160
- | **Overall** | **45** | **100%** | |
161
-
162
- ### Sample Model Responses
163
-
164
- | Test | Model Output |
165
- |------|-------------|
166
- | **greeting** | "I'm here to help with any questions you may have. Whether it's programming, technology, or general knowledge, feel free to ask." |
167
- | **name-recall** | "Your name is Beer. It's nice to know you're here with me today." |
168
- | **json-array** | `["red","blue","yellow"]` |
169
- | **weather-query** | "Tokyo has four seasons: spring (March to May), summer (June to August), autumn (September to November), and winter (December to February)." |
170
- | **coding** | `def is_palindrome(string): cleaned = ''.join(char.lower() for char in string if char.isalnum()) ...` |
171
- | **json-object** | `{"name": "John", "age": 30, "city": "London"}` |
172
- | **markdown-table** | `| Language | Typing | Speed |` with Python, JavaScript, Rust rows |
173
-
174
- Full evaluation report: [`eval/EVAL.md`](https://huggingface.co/Nanthasit/sakthai-context-1.5b-merged/blob/main/eval/EVAL.md)
175
-
176
- ## Model Comparison
177
-
178
- | Feature | 0.5B | 1.5B (this) | 7B |
179
- |---------|:----:|:------------:|:--:|
180
- | Parameters | 494M | **1.54B** | 7.6B |
181
- | Eval Pass Rate | 100% (15/15) | **100% (45/45)** | 100% (8/8) |
182
- | Download Count | 625 | **802** 🏆 | 463 |
183
- | GGUF Available | ❌ | **✅ Q4_K_M** | ❌ |
184
- | CPU Inference | ✅ Fast | ✅ Good | ⚠️ Slow |
185
- | GPU Required | Optional | Optional | Recommended |
186
-
187
- ## Limitations
188
-
189
- - **Tool-calling specialization:** Primarily optimized for structured tool use. General knowledge capabilities reflect the base Qwen2.5 model.
190
- - **Latency:** Average response time ~34s on CPU. GPU inference is significantly faster.
191
- - **Language:** Trained on English data only.
192
- - **Safety:** Inherits base model alignment. Not fine-tuned for safety moderation.
193
-
194
- ## Citation
195
-
196
- ```bibtex
197
- @misc{sakthai-context-1.5b,
198
- author = {Nanthasit Burankum},
199
- title = {SakThai Context 1.5B: A Tool-Calling Language Model for Agentic Workflows},
200
- year = {2026},
201
- publisher = {Hugging Face},
202
- journal = {House of Sak Model Family},
203
- howpublished = {\url{https://huggingface.co/Nanthasit/sakthai-context-1.5b-merged}}
204
- }
205
- ```
206
-
207
- ## Resources
208
-
209
- | Resource | Link |
210
- |----------|------|
211
- | 🏠 **House of Sak** | [house-of-sak.vercel.app](https://house-of-sak.vercel.app) |
212
- | 👤 **HF Profile** | [huggingface.co/Nanthasit](https://huggingface.co/Nanthasit) |
213
- | 🐙 **GitHub** | [github.com/beer-sakthai](https://github.com/beer-sakthai) |
214
- | 📦 **LoRA Adapter** | [sakthai-context-1.5b-tools](https://huggingface.co/Nanthasit/sakthai-context-1.5b-tools) |
215
- | 📊 **Training Data** | [sakthai-combined-v4](https://huggingface.co/datasets/Nanthasit/sakthai-combined-v4) |
216
- | 📈 **Eval Report** | `eval/EVAL.md` |
217
- | ⚡ **GGUF** | `gguf/sakthai-1.5b-Q4_K_M.gguf` |
 
5
  library_name: transformers
6
  pipeline_tag: text-generation
7
  tags:
8
+ - qwen2.5
9
  - sakthai
10
  - house-of-sak
11
  - tool-calling
12
  - instruct
 
13
  - agent
14
  - function-calling
15
+ - assistant
16
  datasets:
17
+ - Nanthasit/sakthai-combined-v5
18
  base_model: Qwen/Qwen2.5-1.5B-Instruct
19
+ widget:
20
+ - text: "What's the weather in Tokyo?"
21
+ output:
22
+ text: "<tool_call>\n{\"name\": \"get_weather\", \"arguments\": {\"location\": \"Tokyo\"}}\n</tool_call>"
23
+ - text: "Who wrote Romeo and Juliet?"
24
+ output:
25
+ text: "William Shakespeare wrote Romeo and Juliet."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  ---
27
+ # SakThai Context 1.5B
28
 
29
+ **The most popular SakThai model — 800+ downloads.**
 
 
 
 
 
 
 
 
 
 
30
 
31
+ A fine-tuned [Qwen2.5-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct) for **tool-calling and agentic tasks**. Trained on the SakThai v5 combined dataset with QLoRA.
32
 
33
+ ## What it does
34
 
35
+ - **Tool calling** knows when to call tools vs answer directly
36
+ - **Cycle-aware** — operates within Dream→Hope→Care→Joy→Trust→Growth energy cycle
37
+ - **Agentic** multi-turn conversations with tool use
38
+ - **Zero-cost mindset** trained to prefer free solutions
 
 
 
39
 
40
  ## Quick Start
41
 
 
42
  ```python
43
  from transformers import AutoModelForCausalLM, AutoTokenizer
44
+ import torch
45
 
46
  model = AutoModelForCausalLM.from_pretrained(
47
+ \"Nanthasit/sakthai-context-1.5b-merged\",
48
+ torch_dtype=torch.bfloat16,
49
+ device_map=\"auto\"
50
  )
51
+ tokenizer = AutoTokenizer.from_pretrained(\"Nanthasit/sakthai-context-1.5b-merged\")
52
 
53
  messages = [
54
+ {\"role\": \"system\", \"content\": \"You are SakThai-Agent, a helpful assistant. Call tools when needed.\"},
55
+ {\"role\": \"user\", \"content\": \"What's the weather in Bangkok?\"},
56
  ]
57
+ inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors=\"pt\")
58
+ outputs = model.generate(inputs, max_new_tokens=128, temperature=0.3)
 
59
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
60
  ```
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  ## Training Details
63
 
64
+ | Detail | Value |
65
+ |--------|-------|
66
+ | Base model | Qwen2.5-1.5B-Instruct |
67
+ | Dataset | Nanthasit/sakthai-combined-v5 |
68
+ | Method | QLoRA (4-bit) |
69
+ | LoRA rank | 16 |
70
+ | Target modules | All linear layers |
71
+ | Format | ChatML with tool schema |
72
+
73
+ ## Variants
74
+
75
+ | Model | Size | Downloads |
76
+ |-------|------|-----------|
77
+ | [0.5B merged](https://huggingface.co/Nanthasit/sakthai-context-0.5b-merged) | 0.5B | 625 |
78
+ | [1.5B merged](https://huggingface.co/Nanthasit/sakthai-context-1.5b-merged) | 1.5B | **802** you are here |
79
+ | [7B merged](https://huggingface.co/Nanthasit/sakthai-context-7b-merged) | 7B | 463 |