Download kaggle/notebook_final.py from idefinity/webfm-eval: direct link, hf CLI and curl.
- Browser
- Download file 1.95 kB
-
https://huggingface.co/datasets/idefinity/webfm-eval/resolve/main/kaggle/notebook_final.py
- Command line
-
hf download hf://datasets/idefinity/webfm-eval/kaggle/notebook_final.py
-
curl -L -o notebook_final.py https://huggingface.co/datasets/idefinity/webfm-eval/resolve/main/kaggle/notebook_final.py
1.95 kB
| """Kaggle notebook body: release-candidate run at the operating point. | |
| 4000 steps was the best configuration; 8000 regressed. This run reproduces it | |
| with the teacher seeded, and this time keeps the audio so the result can be | |
| judged by ear rather than only by CER. | |
| Produces: | |
| train/student4.pt weights | |
| train/dit4.onnx 412 MB fp32 | |
| train/dit4_int4.onnx 70 MB int4 | |
| train/eval_rows*.json teacher / student / int4 on a07 + a08 | |
| train/eval_wavs/*.wav teacher and student audio for the same cells | |
| Uses the cached trajectories, so no regeneration. | |
| """ | |
| import os | |
| import subprocess | |
| import sys | |
| from notebook_eval import BUNDLE, MODEL, ROOT, WEIGHTS, pull, stage_deps, stage_repo | |
| BUNDLE_REPO = "idefinity/webfm-eval" | |
| 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"final_{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"final_{tag}.log").read_text()[-2500:]) | |
| return rc | |
| def main() -> None: | |
| stage_repo() | |
| stage_deps() | |
| pull(WEIGHTS, MODEL) | |
| pull(BUNDLE_REPO, BUNDLE, repo_type="dataset") | |
| if not (BUNDLE / "traj.zip").exists(): | |
| raise SystemExit("traj.zip missing") | |
| if run("main", {"STAGE": "all", "TRAIN_STEPS": TRAIN_STEPS, "BATCH": "16", | |
| "EVAL_VOICES": EVAL_VOICES, "SAVE_WAVS": "1"}) != 0: | |
| raise SystemExit("train/export/eval failed") | |
| run("int4", {"STAGE": "eval_int4", "EVAL_VOICES": EVAL_VOICES}) | |
| if __name__ == "__main__": | |
| main() | |