File size: 11,161 Bytes
85bd402
 
 
 
 
 
 
 
 
1c798f5
11e6b5e
 
 
 
85bd402
 
c52bf9c
 
11e6b5e
85bd402
96dffdb
11e6b5e
 
 
 
 
 
 
 
c52bf9c
11e6b5e
 
 
 
 
 
 
 
4e7de24
11f825d
11e6b5e
 
d732fee
11e6b5e
d732fee
96dffdb
11e6b5e
 
 
d732fee
e22a662
96dffdb
11e6b5e
d732fee
 
 
 
 
 
 
96dffdb
d732fee
 
1c798f5
d732fee
11e6b5e
d732fee
 
 
 
 
 
 
 
11e6b5e
d732fee
11e6b5e
d732fee
11e6b5e
d732fee
 
 
 
11e6b5e
d732fee
11e6b5e
d732fee
 
 
 
 
 
 
 
11e6b5e
d732fee
11e6b5e
d732fee
 
 
 
11f825d
d732fee
11f825d
d732fee
 
 
 
 
 
 
 
 
 
 
 
 
11e6b5e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11f825d
 
11e6b5e
 
11f825d
11e6b5e
 
 
 
1c798f5
 
e22a662
d732fee
11e6b5e
 
 
 
96dffdb
11e6b5e
 
d732fee
96dffdb
d732fee
 
96dffdb
 
 
 
11e6b5e
 
96dffdb
11f825d
 
 
 
 
 
 
 
 
 
d732fee
11e6b5e
 
 
 
 
 
 
 
 
 
 
 
 
96dffdb
11e6b5e
1c798f5
11e6b5e
 
96dffdb
11e6b5e
1c798f5
858c458
11e6b5e
 
 
96dffdb
11e6b5e
 
 
96dffdb
11e6b5e
96dffdb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11e6b5e
 
 
96dffdb
e22a662
96dffdb
 
 
 
 
 
 
 
11e6b5e
96dffdb
e22a662
96dffdb
 
 
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
---
license: apache-2.0
language:
- en
tags:
- sakthai
- house-of-sak
- notebooks
- fine-tuning
- kaggle
datasets:
- Nanthasit/sakthai-combined-v6
- Nanthasit/sakthai-combined-v7
- Nanthasit/sakthai-bench-v1
---

# SakThai Kaggle Notebooks & Deploy Scripts

<div align="center">

[![Dataset on HF](https://huggingface.co/datasets/Nanthasit/sakthai-kaggle-notebooks/badge.svg)](https://huggingface.co/datasets/Nanthasit/sakthai-kaggle-notebooks)
[![Downloads](https://img.shields.io/badge/dynamic/json?url=https://huggingface.co/api/datasets/Nanthasit/sakthai-kaggle-notebooks&query=$.downloads&label=downloads&color=blue)](https://huggingface.co/datasets/Nanthasit/sakthai-kaggle-notebooks)
![Last updated](https://img.shields.io/badge/updated-2026--07--30-green)
![License](https://img.shields.io/badge/license-Apache%202.0-brightgreen)
[![Collection](https://img.shields.io/badge/🏠-SakThai%20Family-6644cc)](https://huggingface.co/collections/Nanthasit/sakthai-model-family-6a64745450b12d421c1f9f02)

</div>

> The exact training notebooks, job scripts, and deploy scripts used to build the **SakThai** family —
> LoRA fine-tune → GGUF conversion → HF publish, all on free Kaggle GPUs.
> Part of the [House of Sak](https://huggingface.co/Nanthasit).

---

## Dataset Info

| Attribute | Value |
|-----------|-------|
| Files | **16** (14 content files + `README.md` + `.gitattributes`) |
| Total size | **~141 KB** |
| Created | 2026-07-06 |
| Last updated | 2026-07-30 |
| Downloads | **184** |
| License | Apache 2.0 |
| Repository type | Dataset (notebook & script collection) |
| Format | `.py` (PEP 723 inline-script), `.ipynb` (Jupyter notebook) |

---

## Data Fields

This dataset is a **collection of Python scripts and Jupyter notebooks**, not a tabular dataset. Each file is a self-contained artifact with the following attributes:

| Field | Type | Description |
|-------|------|-------------|
| `filename` | `string` | File name (e.g., `job-0.5b-v7.py`) |
| `path` | `string` | Full path within the repo (e.g., `scripts/train-sakthai-1.5b-v2.py`) |
| `size` | `integer` | File size in KB |
| `type` | `string` | Category: `training-notebook`, `training-script`, `eval-script`, `validation-script`, `deployment-script`, `infra` |
| `model_target` | `string` | Target model size: `0.5B`, `1.5B`, `7B`, or `all` |
| `purpose` | `string` | One-sentence description of the file's role in the pipeline |
| `era` | `string` | Pipeline generation: `v6-era`, `v7-era`, or `infra` |
| `dependencies` | `string` | Key Python package dependencies (e.g., `transformers`, `trl`, `peft`, `huggingface_hub`) |

### Category Breakdown

| Category | Count | Files |
|----------|-------|-------|
| Training notebooks | 2 | `sakthai-engine.ipynb`, `sakthai-7b-engine.ipynb` |
| 0.5B job scripts | 6 | `train-sakthai-0.5b-v2.py`, `job-0.5b-v7.py`, `job-0.5b-hfjobs.py`, `job-0.5b-exp.py`, `job-0.5b-nanguard.py`, `job-0.5b-nanhunt.py` |
| 1.5B / 7B scripts | 2 | `scripts/train-sakthai-1.5b-v2.py`, `scripts/sakthai-7b-post-train.py` |
| Evaluation & validation | 3 | `eval-bfcl-0.5b.py`, `validate.py`, `validate_exp.py` |
| Deployment | 1 | `deploy-endpoint.py` |
| Infrastructure | 2 | `README.md`, `.gitattributes` |

### File Details

#### Training Notebooks

| File | Size | Model | Era | Dependencies |
|------|------|-------|-----|-------------|
| `sakthai-engine.ipynb` | 10.5 KB | 1.5B (Qwen2.5-1.5B-Instruct) | v6 | `transformers`, `trl`, `peft`, `bitsandbytes`, `accelerate`, `huggingface_hub`, `wandb` |
| `sakthai-7b-engine.ipynb` | 24.0 KB | 7B (Qwen2.5-7B-Instruct) | v6 | `transformers`, `trl`, `peft`, `bitsandbytes`, `accelerate`, `huggingface_hub`, `wandb` |

#### Job Scripts (0.5B)

| File | Size | Model | Era | Dependencies |
|------|------|-------|-----|-------------|
| `train-sakthai-0.5b-v2.py` | 6.8 KB | 0.5B (Qwen2.5-0.5B-Instruct) | v6 | `transformers`, `trl`, `peft`, `datasets`, `huggingface_hub` |
| `job-0.5b-v7.py` | 10.2 KB | 0.5B | v7 | `transformers`, `trl`, `peft`, `datasets`, `huggingface_hub` |
| `job-0.5b-hfjobs.py` | 7.8 KB | 0.5B | v7 | `transformers`, `trl`, `peft`, `datasets` |
| `job-0.5b-exp.py` | 12.9 KB | 0.5B | v7 | `transformers`, `trl`, `peft`, `datasets`, `wandb` |
| `job-0.5b-nanguard.py` | 13.2 KB | 0.5B | v7 | `transformers`, `trl`, `peft`, `datasets` |
| `job-0.5b-nanhunt.py` | 11.8 KB | 0.5B | v7 | `transformers`, `trl`, `peft`, `datasets` |

#### Training Scripts (1.5B, 7B)

| File | Size | Model | Era | Dependencies |
|------|------|-------|-----|-------------|
| `scripts/train-sakthai-1.5b-v2.py` | 4.5 KB | 1.5B | v6 | `transformers`, `trl`, `peft`, `datasets` |
| `scripts/sakthai-7b-post-train.py` | 13.7 KB | 7B | v6 | `transformers`, `peft`, `huggingface_hub`, `llama-cpp-python` |

#### Evaluation & Validation

| File | Size | Model | Era | Dependencies |
|------|------|-------|-----|-------------|
| `eval-bfcl-0.5b.py` | 3.9 KB | 0.5B | v7 | `datasets`, `transformers`, `torch` |
| `validate.py` | 4.9 KB | 0.5B | v7 | `datasets`, `transformers` |
| `validate_exp.py` | 3.7 KB | 0.5B | v7 | `datasets`, `transformers` |

#### Deployment & Infra

| File | Size | Purpose | Dependencies |
|------|------|---------|-------------|
| `deploy-endpoint.py` | 3.1 KB | Deploy to HF Inference Endpoints | `huggingface_hub` |
| `.gitattributes` | 2.4 KB | Git LFS config | — |
| `README.md` | ~7 KB | Dataset card (this file) | — |

---

## How These Notebooks Were Collected & Filtered

**Origin.** These notebooks were written from scratch by the SakThai project as part of the iterative model development pipeline. They are not scraped or collected from external sources — each script was authored to solve a specific training, evaluation, or deployment need.

**Evolution.** The collection grew organically across multiple training cycles:

1. **v6 era** (July 2026) — Initial notebooks trained the 1.5B and 7B models on `sakthai-combined-v6` via Kaggle's free T4 GPU. These produced the first merged models and established the LoRA → GGUF pipeline.

2. **v7 era** (late July 2026) — A new generation of job scripts was written to fine-tune the 0.5B variant on `sakthai-combined-v7`. These scripts incorporated lessons from earlier failures:
   - **No mid-run Hub pushes** (`save_strategy="no"`) — a checkpoint push failure had killed a 2-hour run
   - **No Trackio logging** (`report_to="none"`) — Trackio's config-to-parquet export couldn't serialise PEFT's empty `rank_pattern` struct
   - **Bench-exclusion filtering** — every row reserved by `sakthai-bench-v1` is excluded from training
   - **Prompt masking** — loss computed only on completion tokens, not the system prompt

3. **Validation scripts** — Two `validate*.py` scripts were added to prove every non-GPU component locally before launching paid jobs, catching data pipeline bugs early.

4. **Experimental scripts** — `job-0.5b-exp.py`, `job-0.5b-nanguard.py`, and `job-0.5b-nanhunt.py` capture specific run configurations for reproducibility of ablation studies on prompt masking and LoRA strategies.

**Filtering criteria.** Scripts were included if they:
- Directly contribute to training, evaluating, validating, or deploying a SakThai model
- Are self-contained (PEP 723 inline script metadata for dependencies where applicable)
- Are licensed Apache 2.0
- Are functionally distinct (duplicate-mode scripts like `nanguard`/`nanhunt` are included because they capture specific run configurations for reproducibility)

---

## Usage

### Load with the 🤗 Datasets library

```python
from datasets import load_dataset

# Load the dataset (returns a Dataset with file metadata)
ds = load_dataset("Nanthasit/sakthai-kaggle-notebooks", split="train")
print(ds)
# Dataset({
#     features: ['filename', 'path', 'size', 'type', 'model_target', 'purpose', 'era', 'dependencies'],
#     num_rows: 16
# })

# List all filenames in the collection
for row in ds:
    print(f"{row['filename']:40s} {row['type']:20s} {row['model_target']:6s} {row['era']}")
```

### List all available files via HfApi

```python
from huggingface_hub import HfApi

api = HfApi()
files = api.list_repo_files("Nanthasit/sakthai-kaggle-notebooks", repo_type="dataset")
for f in sorted(files):
    print(f)
```

### Download a specific script

```python
from huggingface_hub import hf_hub_download

# Download a specific training script
script_path = hf_hub_download(
    repo_id="Nanthasit/sakthai-kaggle-notebooks",
    repo_type="dataset",
    filename="job-0.5b-v7.py"
)
print(f"Downloaded to: {script_path}")
```

### Run a training job (PEP 723 inline-script)

```bash
# All job scripts are PEP 723 inline-script compatible
cd /tmp
curl -OL https://huggingface.co/datasets/Nanthasit/sakthai-kaggle-notebooks/raw/main/job-0.5b-v7.py
uv run job-0.5b-v7.py
```

### Open notebooks in Kaggle

```bash
curl -OL https://huggingface.co/datasets/Nanthasit/sakthai-kaggle-notebooks/raw/main/sakthai-engine.ipynb
# Then upload to Kaggle via kaggle kernels push
```

---

## File Inventory

| # | File | Type | Size |
|---|------|------|------|
| 1 | `sakthai-engine.ipynb` | Training notebook (1.5B) | 10.5 KB |
| 2 | `sakthai-7b-engine.ipynb` | Training notebook (7B) | 24.0 KB |
| 3 | `train-sakthai-0.5b-v2.py` | Training script (0.5B, v6) | 6.8 KB |
| 4 | `job-0.5b-v7.py` | Training script (0.5B, v7) | 10.2 KB |
| 5 | `job-0.5b-hfjobs.py` | Training script (0.5B, HF Jobs) | 7.8 KB |
| 6 | `job-0.5b-exp.py` | Experimental script (0.5B) | 12.9 KB |
| 7 | `job-0.5b-nanguard.py` | Ablation: nan guard | 13.2 KB |
| 8 | `job-0.5b-nanhunt.py` | Ablation: nan hunt | 11.8 KB |
| 9 | `scripts/train-sakthai-1.5b-v2.py` | Training script (1.5B) | 4.5 KB |
| 10 | `scripts/sakthai-7b-post-train.py` | Post-training (7B) | 13.7 KB |
| 11 | `eval-bfcl-0.5b.py` | BFCL evaluation | 3.9 KB |
| 12 | `validate.py` | Validation script | 4.9 KB |
| 13 | `validate_exp.py` | Experimental validation | 3.7 KB |
| 14 | `deploy-endpoint.py` | Deploy to HF Endpoints | 3.1 KB |
| 15 | `.gitattributes` | Git LFS config | 2.4 KB |
| 16 | `README.md` | This dataset card | ~7 KB |

---

## Related Datasets & Models

| Asset | Description |
|-------|-------------|
| [Nanthasit/sakthai-combined-v6](https://huggingface.co/datasets/Nanthasit/sakthai-combined-v6) | Base training data (v6 generation) |
| [Nanthasit/sakthai-combined-v7](https://huggingface.co/datasets/Nanthasit/sakthai-combined-v7) | Extended training data (v7 generation) |
| [Nanthasit/sakthai-bench-v1](https://huggingface.co/datasets/Nanthasit/sakthai-bench-v1) | Benchmark holdout data |
| [Nanthasit/sakthai-tool-calling-v1](https://huggingface.co/datasets/Nanthasit/sakthai-tool-calling-v1) | Tool-calling training data (SimpleToolCalling) |
| 🤖 [SakThai Agents](https://huggingface.co/Nanthasit) | All models in the House of Sak |
| 🏠 [SakThai Model Family](https://huggingface.co/collections/Nanthasit/sakthai-model-family-6a64745450b12d421c1f9f02) | Complete model family collection |

---

<div align="center">
<sub>Built with ❤️ by Beer · Part of the <a href="https://huggingface.co/Nanthasit">House of Sak</a> — one family, one home.</sub>
</div>