"""Kaggle notebook body: is the student undertrained, or unable to generalise? Run 2 landed at +3.05 pp overall: +1.95 pp on a voice it trained on (a08) and +4.15 pp on the held-out one (a07). The CUDA source confirms the CFG convention matches our training target exactly, so the recipe is not the suspect. What is: the loss was still falling at step 1500, and 1500 x batch 16 = 24,000 samples against roughly 28,800 frames of data — under one epoch. So this run changes one thing: 4,000 steps. Same six voices, same a07 holdout, same evaluation. It also packs the trajectory cache into traj.zip so the next ablation does not have to spend 50 minutes regenerating it. traj 6 voices x 120 texts, 2 GPUs ~50 min pack zip the cache ~2 min train 4-step, 4000 steps ~65 min eval a07 + a08, teacher vs student ~15 min int4 same cells through int4 ~12 min """ import os import subprocess import sys import time from notebook_eval import BUNDLE, MODEL, ROOT, WEIGHTS, pull, stage_deps, stage_repo BUNDLE_REPO = "idefinity/webfm-eval" SHARDS = [["a01", "a03", "a04"], ["a05", "a06", "a08"]] HOLDOUT = "a07" EVAL_VOICES = "a07,a08" TRAIN_STEPS = "4000" def run(tag: str, extra: dict, gpu: int = 0) -> int: env = dict(os.environ, WORK_ROOT=str(ROOT), HOLDOUT=HOLDOUT, **extra) env["CUDA_VISIBLE_DEVICES"] = str(gpu) env["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True" log = open(ROOT / f"learn_{tag}.log", "w") p = subprocess.Popen([sys.executable, str(BUNDLE / "kaggle/train_voices.py")], env=env, stdout=log, stderr=subprocess.STDOUT, cwd=str(ROOT)) rc = p.wait() print(f"[{tag}] rc={rc}", flush=True) if rc != 0: print((ROOT / f"learn_{tag}.log").read_text()[-2500:]) return rc def main() -> None: stage_repo() stage_deps() pull(WEIGHTS, MODEL) pull(BUNDLE_REPO, BUNDLE, repo_type="dataset") print("== trajectories (6 voices, a07 held out) ==", flush=True) procs = [] for gpu, shard in enumerate(SHARDS): env = dict(os.environ, WORK_ROOT=str(ROOT), STAGE="traj", HOLDOUT=HOLDOUT, VOICES=",".join(shard), CUDA_VISIBLE_DEVICES=str(gpu)) log = open(ROOT / f"traj_gpu{gpu}.log", "w") procs.append(subprocess.Popen([sys.executable, str(BUNDLE / "kaggle/train_voices.py")], env=env, stdout=log, stderr=subprocess.STDOUT, cwd=str(ROOT))) while any(p.poll() is None for p in procs): time.sleep(60) n = len(list((ROOT / "train/traj").glob("*/*.pt"))) print(f"[{time.strftime('%H:%M')}] trajectories={n}", flush=True) print("traj exits:", [p.returncode for p in procs]) # Keep the cache: regenerating it costs 50 minutes per experiment. subprocess.run(f"cd {ROOT}/train && zip -qr ../traj.zip traj", shell=True, check=False) print("cache size:", (ROOT / "traj.zip").stat().st_size // 1024 // 1024, "MB", flush=True) if run("final", {"STAGE": "all", "TRAIN_STEPS": TRAIN_STEPS, "BATCH": "16", "EVAL_VOICES": EVAL_VOICES}) != 0: raise SystemExit("train/export/eval failed") run("int4", {"STAGE": "eval_int4", "EVAL_VOICES": EVAL_VOICES}) if __name__ == "__main__": main()