betterwithage commited on
Commit
53342a3
·
verified ·
1 Parent(s): 95119b4

feat(train): Qwen3.5-0.8B Apache (license lock), receiptagent knobs

Browse files
Files changed (1) hide show
  1. train_chaski.py +17 -18
train_chaski.py CHANGED
@@ -11,15 +11,9 @@
11
  # "trackio",
12
  # ]
13
  # ///
14
- """Chaski training — receiptagent pattern, not generic train_szl.py.
15
-
16
- LOCKED (do not invent):
17
- - Loss is TRL CE + Unsloth train_on_responses_only. No Λ / locked-8 / loop-tax term.
18
- - Λ uniqueness is Conjecture 1 (identity curriculum only).
19
- - Doctrine v11 LOCKED 749/14/163 @ c7c0ba17 (identity curriculum only).
20
- - seed 11, lr 2e-4, adamw_8bit, wd 0.01, LoRA r=16 α=16 (1.5B card).
21
- - Brain/A11oy corpus excluded.
22
- - Evals only if a held-out gate actually runs. This job records training MEASURED; eval is none-this-run.
23
  """
24
  from __future__ import annotations
25
 
@@ -34,14 +28,15 @@ from unsloth import FastLanguageModel
34
  from unsloth.chat_templates import train_on_responses_only
35
  from trl import SFTConfig, SFTTrainer
36
 
37
- MAX_SEQ_LEN = 1024
38
- BASE = os.environ.get("BASE_MODEL", "unsloth/Qwen2.5-1.5B-Instruct-bnb-4bit")
39
- CANONICAL_BASE = "Qwen/Qwen2.5-1.5B-Instruct"
40
  HUB = os.environ.get("HUB_MODEL_ID", "SZLHOLDINGS/chaski")
41
  DATASET = "SZLHOLDINGS/szl-1-doctrine-sft"
42
  SEED = 11
43
  LORA_R = 16
44
- LORA_ALPHA = 16
 
45
 
46
  OUROBOROS = [
47
  {
@@ -115,8 +110,8 @@ trainer = SFTTrainer(
115
  max_seq_length=MAX_SEQ_LEN,
116
  args=SFTConfig(
117
  per_device_train_batch_size=1,
118
- gradient_accumulation_steps=8,
119
- num_train_epochs=3,
120
  warmup_steps=6,
121
  learning_rate=2e-4,
122
  logging_steps=1,
@@ -127,7 +122,7 @@ trainer = SFTTrainer(
127
  output_dir="outputs",
128
  report_to="trackio",
129
  project="szl-chaski",
130
- run_name="chaski-doctrine-sft-v1",
131
  push_to_hub=True,
132
  hub_model_id=HUB,
133
  hub_private_repo=False,
@@ -150,7 +145,10 @@ print(f"[chaski] train done loss={loss} metrics={metrics}")
150
  adapter_dir = "chaski-adapter"
151
  model.save_pretrained(adapter_dir)
152
  tokenizer.save_pretrained(adapter_dir)
153
- model.save_pretrained_merged("chaski-merged", tokenizer, save_method="merged_16bit")
 
 
 
154
 
155
  api = HfApi()
156
  receipt = {
@@ -158,13 +156,14 @@ receipt = {
158
  "schema": "szl.frontier-training-run/v1",
159
  "artifact": HUB,
160
  "base_model": CANONICAL_BASE,
 
161
  "base_model_runtime": BASE,
162
  "dataset": DATASET,
163
  "dataset_sha256": doctrine_sha,
164
  "extra_identity_turns": len(OUROBOROS),
165
  "training_rows": len(rows),
166
  "seed": SEED,
167
- "num_train_epochs": 3,
168
  "warmup_steps": 6,
169
  "lora_r": LORA_R,
170
  "lora_alpha": LORA_ALPHA,
 
11
  # "trackio",
12
  # ]
13
  # ///
14
+ """Chaski training — Qwen3.5-0.8B Apache (ATELIER license lock 28 Aug 2026).
15
+ Receiptagent pattern: response-only CE. No Λ / locked-8 / loop-tax in the loss.
16
+ Evals none-this-run (no fabricated 5/5).
 
 
 
 
 
 
17
  """
18
  from __future__ import annotations
19
 
 
28
  from unsloth.chat_templates import train_on_responses_only
29
  from trl import SFTConfig, SFTTrainer
30
 
31
+ MAX_SEQ_LEN = 2048
32
+ BASE = os.environ.get("BASE_MODEL", "unsloth/Qwen3.5-0.8B")
33
+ CANONICAL_BASE = "Qwen/Qwen3.5-0.8B"
34
  HUB = os.environ.get("HUB_MODEL_ID", "SZLHOLDINGS/chaski")
35
  DATASET = "SZLHOLDINGS/szl-1-doctrine-sft"
36
  SEED = 11
37
  LORA_R = 16
38
+ LORA_ALPHA = 32
39
+ MAX_STEPS = 64
40
 
41
  OUROBOROS = [
42
  {
 
110
  max_seq_length=MAX_SEQ_LEN,
111
  args=SFTConfig(
112
  per_device_train_batch_size=1,
113
+ gradient_accumulation_steps=2,
114
+ max_steps=MAX_STEPS,
115
  warmup_steps=6,
116
  learning_rate=2e-4,
117
  logging_steps=1,
 
122
  output_dir="outputs",
123
  report_to="trackio",
124
  project="szl-chaski",
125
+ run_name="chaski-qwen35-0.8b-doctrine-v1",
126
  push_to_hub=True,
127
  hub_model_id=HUB,
128
  hub_private_repo=False,
 
145
  adapter_dir = "chaski-adapter"
146
  model.save_pretrained(adapter_dir)
147
  tokenizer.save_pretrained(adapter_dir)
148
+ try:
149
+ model.save_pretrained_merged("chaski-merged", tokenizer, save_method="merged_16bit")
150
+ except Exception as exc:
151
+ print(f"[chaski] merge skipped: {type(exc).__name__}: {exc}")
152
 
153
  api = HfApi()
154
  receipt = {
 
156
  "schema": "szl.frontier-training-run/v1",
157
  "artifact": HUB,
158
  "base_model": CANONICAL_BASE,
159
+ "base_model_relation": "adapter",
160
  "base_model_runtime": BASE,
161
  "dataset": DATASET,
162
  "dataset_sha256": doctrine_sha,
163
  "extra_identity_turns": len(OUROBOROS),
164
  "training_rows": len(rows),
165
  "seed": SEED,
166
+ "max_steps": MAX_STEPS,
167
  "warmup_steps": 6,
168
  "lora_r": LORA_R,
169
  "lora_alpha": LORA_ALPHA,