File size: 3,708 Bytes
99e43cf | 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 | ---
license: apache-2.0
library_name: other
tags:
- governed-ai
- szl-holdings
- doctrine-v11
- estate
- hub
---
# szl-training-scripts
The forge. Hub copy of the Unsloth-receipted training scripts. Tags were empty — this atelier is the card.
**Family.** estate · **Evidence.** HUB · **Weights.** none
Hub: [SZLHOLDINGS/szl-training-scripts](https://huggingface.co/SZLHOLDINGS/szl-training-scripts)
## The cut
Training code is usually a gist. We give it a model id so the estate graph stays one piece.
A Hub id you can pin in a receipt: 'trained by this repo at this SHA'.
### Silhouette → leave → SZL
| Leader | Take, then tweak |
|---|---|
| Anthropic | No public train scripts for Claude. |
| NVIDIA | NeMo recipes. |
| Unsloth | The scripts wrap Unsloth. Cut is the receipt bind. |
Nobody else ships this combination. That is the point of a one-of-one.
## Intended use
Canonical train entrypoint.
## Limitations
- Not a checkpoint. Wire to GitHub kit in this atelier.
## Honesty
| Claim | Label |
|---|---|
| This card's numbers | HUB |
| Energy / joules | UNAVAILABLE unless a signed meter says MEASURED |
| Λ uniqueness | Conjecture 1 OPEN — not a theorem |
| GGUF as the signed object | FALSE |
Doctrine v11 LOCKED · 749 declarations · 14 axioms · 163 sorries · locked-proven 8.
Apache-2.0. Copyright 2026 SZL Holdings · Stephen P. Lutar Jr. · ORCID [0009-0001-0110-4173](https://orcid.org/0009-0001-0110-4173).
## GitHub-aligned Python
```python
#!/usr/bin/env python3
# receipted_unsloth.py
# Silhouette: Unsloth FastLanguageModel QLoRA.
# Cut: dataset SHA, LoRA knobs, seed, and final loss go into a training receipt
# BEFORE merge. GGUF is derived — never the signed object.
from __future__ import annotations
import argparse
import hashlib
import json
import time
from pathlib import Path
def sha256_file(p: Path) -> str:
h = hashlib.sha256()
with p.open("rb") as f:
for chunk in iter(lambda: f.read(1 << 20), b""):
h.update(chunk)
return h.hexdigest()
def main() -> None:
ap = argparse.ArgumentParser()
ap.add_argument("--base", default="Qwen/Qwen2.5-1.5B-Instruct")
ap.add_argument("--data", default="doctrine.jsonl")
ap.add_argument("--out", default="out/adapter")
ap.add_argument("--r", type=int, default=16)
ap.add_argument("--seed", type=int, default=20260721)
ap.add_argument("--max-seq", type=int, default=2048)
args = ap.parse_args()
data_sha = sha256_file(Path(args.data))
from unsloth import FastLanguageModel
from datasets import load_dataset
from trl import SFTConfig, SFTTrainer
model, tokenizer = FastLanguageModel.from_pretrained(
model_name=args.base,
max_seq_length=args.max_seq,
load_in_4bit=True,
)
model = FastLanguageModel.get_peft_model(
model,
r=args.r,
lora_alpha=args.r,
target_modules=["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"],
lora_dropout=0,
bias="none",
use_gradient_checkpointing="unsloth",
random_state=args.seed,
)
ds = load_dataset("json", data_files=args.data, split="train")
trainer = SFTTrainer(
model=model,
tokenizer=tokenizer,
train_dataset=ds,
args=SFTConfig(
output_dir=args.out,
per_device_train_batch_size=2,
gradient_accumulation_steps=4,
max_steps=120,
learning_rate=2e-4,
logging_steps=10,
seed=args.seed,
),
)
t0 = time.time()
trainer.train()
model.save_pretrained(args.out)
loss = None
if trainer.state.log_hi
```
|