run4: unpack cached traj, seed teacher, 8000 steps
Browse files- kaggle/notebook_run4.py +62 -0
kaggle/notebook_run4.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Kaggle notebook body: does more training keep closing the held-out gap?
|
| 2 |
+
|
| 3 |
+
Step count has moved the numbers a lot already:
|
| 4 |
+
|
| 5 |
+
1500 steps a07 +4.15 pp a08 +1.95 pp loss 0.226
|
| 6 |
+
4000 steps a07 +2.30 pp a08 -0.51 pp loss 0.179
|
| 7 |
+
|
| 8 |
+
The loss was still falling at 4000, so this run doubles it to 8000 and does the
|
| 9 |
+
same evaluation. The two columns now answer different questions: if a07 keeps
|
| 10 |
+
improving the student is still underfitted; if a07 stalls or regresses while a08
|
| 11 |
+
improves, it is starting to memorise the six training voices, and the next lever
|
| 12 |
+
is data diversity rather than more steps.
|
| 13 |
+
|
| 14 |
+
Trajectories come from the cached traj.zip, so the 50-minute generation pass is
|
| 15 |
+
skipped unless the cache is missing.
|
| 16 |
+
"""
|
| 17 |
+
import os
|
| 18 |
+
import subprocess
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
from notebook_eval import BUNDLE, MODEL, ROOT, WEIGHTS, pull, stage_deps, stage_repo
|
| 22 |
+
|
| 23 |
+
BUNDLE_REPO = "idefinity/webfm-eval"
|
| 24 |
+
HOLDOUT = "a07"
|
| 25 |
+
EVAL_VOICES = "a07,a08"
|
| 26 |
+
TRAIN_STEPS = "8000"
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def run(tag: str, extra: dict, gpu: int = 0) -> int:
|
| 30 |
+
env = dict(os.environ, WORK_ROOT=str(ROOT), HOLDOUT=HOLDOUT, **extra)
|
| 31 |
+
env["CUDA_VISIBLE_DEVICES"] = str(gpu)
|
| 32 |
+
env["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True"
|
| 33 |
+
log = open(ROOT / f"run4_{tag}.log", "w")
|
| 34 |
+
p = subprocess.Popen([sys.executable, str(BUNDLE / "kaggle/train_voices.py")],
|
| 35 |
+
env=env, stdout=log, stderr=subprocess.STDOUT, cwd=str(ROOT))
|
| 36 |
+
rc = p.wait()
|
| 37 |
+
print(f"[{tag}] rc={rc}", flush=True)
|
| 38 |
+
if rc != 0:
|
| 39 |
+
print((ROOT / f"run4_{tag}.log").read_text()[-2500:])
|
| 40 |
+
return rc
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def main() -> None:
|
| 44 |
+
stage_repo()
|
| 45 |
+
stage_deps()
|
| 46 |
+
pull(WEIGHTS, MODEL)
|
| 47 |
+
pull(BUNDLE_REPO, BUNDLE, repo_type="dataset")
|
| 48 |
+
|
| 49 |
+
if (BUNDLE / "traj.zip").exists():
|
| 50 |
+
print("using cached trajectories", flush=True)
|
| 51 |
+
else:
|
| 52 |
+
raise SystemExit("traj.zip missing from the bundle — regenerate before running")
|
| 53 |
+
|
| 54 |
+
if run("final", {"STAGE": "all", "TRAIN_STEPS": TRAIN_STEPS, "BATCH": "16",
|
| 55 |
+
"EVAL_VOICES": EVAL_VOICES}) != 0:
|
| 56 |
+
raise SystemExit("train/export/eval failed")
|
| 57 |
+
|
| 58 |
+
run("int4", {"STAGE": "eval_int4", "EVAL_VOICES": EVAL_VOICES})
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
if __name__ == "__main__":
|
| 62 |
+
main()
|