42e commited on
Commit
8b1159d
·
verified ·
1 Parent(s): 07d2b7b

Upload folder using huggingface_hub

Browse files
configs/verifier_v_7b.yaml CHANGED
@@ -22,12 +22,12 @@ data:
22
  val_path: "data/verifier/val.jsonl"
23
 
24
  train:
25
- max_length: 4096
26
  per_device_train_batch_size: 16 # up from 4: ~4x fewer forward passes -> much faster
27
  gradient_accumulation_steps: 1 # eff batch 16
28
- gradient_checkpointing: true # keep on (no-ckpt @ seq 4096 OOMs even the 1.5B)
29
- # ~35GB VRAM at these settings. To use more / go faster: raise batch to 24 or 32
30
- # (fits 80GB). NOTE: training has no auto-OOM-recovery — if it OOMs, lower it.
31
 
32
  eval:
33
  processbench_splits: ["gsm8k", "math", "olympiadbench", "omnimath"]
 
22
  val_path: "data/verifier/val.jsonl"
23
 
24
  train:
25
+ max_length: 2560 # measured: V data maxes at 2334 tokens (p99 1715) — 4096 was wasteful
26
  per_device_train_batch_size: 16 # up from 4: ~4x fewer forward passes -> much faster
27
  gradient_accumulation_steps: 1 # eff batch 16
28
+ gradient_checkpointing: true # MUST stay on for 7B (a bug had disabled it for bf16)
29
+ # ~30-40GB VRAM at these settings. To use more / go faster: raise batch to 24/32.
30
+ # NOTE: training has no auto-OOM-recovery — if it OOMs, lower the batch.
31
 
32
  eval:
33
  processbench_splits: ["gsm8k", "math", "olympiadbench", "omnimath"]
src/mathcompose/train/train.py CHANGED
@@ -174,7 +174,12 @@ def build_and_train(args) -> str:
174
  elif gc_mode == "off":
175
  grad_ckpt = False
176
  else:
177
- grad_ckpt = bool(t.get("gradient_checkpointing", True)) and use_4bit
 
 
 
 
 
178
 
179
  optim = t.get("optim", "paged_adamw_8bit") if use_4bit else "adamw_torch"
180
  print(f"[train] epochs={epochs} batch={batch} accum={accum} (eff={batch * accum}) "
 
174
  elif gc_mode == "off":
175
  grad_ckpt = False
176
  else:
177
+ grad_ckpt = bool(t.get("gradient_checkpointing", True)) # independent of quantization
178
+
179
+ # With a frozen (esp. non-kbit) base + LoRA, checkpointing needs input grads
180
+ # enabled so gradients reach the adapters.
181
+ if grad_ckpt and hasattr(model, "enable_input_require_grads"):
182
+ model.enable_input_require_grads()
183
 
184
  optim = t.get("optim", "paged_adamw_8bit") if use_4bit else "adamw_torch"
185
  print(f"[train] epochs={epochs} batch={batch} accum={accum} (eff={batch * accum}) "