release candidate: 4000 steps, seeded teacher, keep audio
Browse files- kaggle/notebook_final.py +58 -0
kaggle/notebook_final.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Kaggle notebook body: release-candidate run at the operating point.
|
| 2 |
+
|
| 3 |
+
4000 steps was the best configuration; 8000 regressed. This run reproduces it
|
| 4 |
+
with the teacher seeded, and this time keeps the audio so the result can be
|
| 5 |
+
judged by ear rather than only by CER.
|
| 6 |
+
|
| 7 |
+
Produces:
|
| 8 |
+
train/student4.pt weights
|
| 9 |
+
train/dit4.onnx 412 MB fp32
|
| 10 |
+
train/dit4_int4.onnx 70 MB int4
|
| 11 |
+
train/eval_rows*.json teacher / student / int4 on a07 + a08
|
| 12 |
+
train/eval_wavs/*.wav teacher and student audio for the same cells
|
| 13 |
+
|
| 14 |
+
Uses the cached trajectories, so no regeneration.
|
| 15 |
+
"""
|
| 16 |
+
import os
|
| 17 |
+
import subprocess
|
| 18 |
+
import sys
|
| 19 |
+
|
| 20 |
+
from notebook_eval import BUNDLE, MODEL, ROOT, WEIGHTS, pull, stage_deps, stage_repo
|
| 21 |
+
|
| 22 |
+
BUNDLE_REPO = "idefinity/webfm-eval"
|
| 23 |
+
HOLDOUT = "a07"
|
| 24 |
+
EVAL_VOICES = "a07,a08"
|
| 25 |
+
TRAIN_STEPS = "4000"
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def run(tag: str, extra: dict, gpu: int = 0) -> int:
|
| 29 |
+
env = dict(os.environ, WORK_ROOT=str(ROOT), HOLDOUT=HOLDOUT, **extra)
|
| 30 |
+
env["CUDA_VISIBLE_DEVICES"] = str(gpu)
|
| 31 |
+
env["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True"
|
| 32 |
+
log = open(ROOT / f"final_{tag}.log", "w")
|
| 33 |
+
p = subprocess.Popen([sys.executable, str(BUNDLE / "kaggle/train_voices.py")],
|
| 34 |
+
env=env, stdout=log, stderr=subprocess.STDOUT, cwd=str(ROOT))
|
| 35 |
+
rc = p.wait()
|
| 36 |
+
print(f"[{tag}] rc={rc}", flush=True)
|
| 37 |
+
if rc != 0:
|
| 38 |
+
print((ROOT / f"final_{tag}.log").read_text()[-2500:])
|
| 39 |
+
return rc
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def main() -> None:
|
| 43 |
+
stage_repo()
|
| 44 |
+
stage_deps()
|
| 45 |
+
pull(WEIGHTS, MODEL)
|
| 46 |
+
pull(BUNDLE_REPO, BUNDLE, repo_type="dataset")
|
| 47 |
+
if not (BUNDLE / "traj.zip").exists():
|
| 48 |
+
raise SystemExit("traj.zip missing")
|
| 49 |
+
|
| 50 |
+
if run("main", {"STAGE": "all", "TRAIN_STEPS": TRAIN_STEPS, "BATCH": "16",
|
| 51 |
+
"EVAL_VOICES": EVAL_VOICES, "SAVE_WAVS": "1"}) != 0:
|
| 52 |
+
raise SystemExit("train/export/eval failed")
|
| 53 |
+
|
| 54 |
+
run("int4", {"STAGE": "eval_int4", "EVAL_VOICES": EVAL_VOICES})
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
if __name__ == "__main__":
|
| 58 |
+
main()
|