File size: 2,183 Bytes
6228d3d 2d691c1 6228d3d 656426d 6228d3d 2d691c1 6228d3d 2eeec3c 6228d3d 2eeec3c 6228d3d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | """Finish the run: quantise and evaluate the student trained in the previous pass.
The training pass ended after ONNX export with
`ModuleNotFoundError: No module named 'onnx_ir'` — the quantiser moved to
onnx-ir. The weights are fine and sit in that pass's output, so this mounts them
and repeats only the two missing stages.
Nothing here regenerates trajectories or retrains.
"""
import glob
import os
import shutil
import subprocess
import sys
from notebook_eval import BUNDLE, MODEL, ROOT, WEIGHTS, pull, stage_deps, stage_repo
BUNDLE_REPO = "idefinity/webfm-eval"
EVAL_VOICES = "a08"
def find_student() -> str | None:
local = BUNDLE / "student4.pt"
if local.exists():
return str(local)
hits = glob.glob("/kaggle/input/**/train/student4.pt", recursive=True)
hits += glob.glob("/kaggle/input/**/student4.pt", recursive=True)
print("student4.pt candidates:", hits)
return hits[0] if hits else None
def run(stage: str, extra: dict | None = None) -> int:
env = dict(os.environ, WORK_ROOT=str(ROOT), STAGE=stage, **(extra or {}))
env["CUDA_VISIBLE_DEVICES"] = "0"
env["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True"
return subprocess.run([sys.executable, str(BUNDLE / "kaggle/train_voices.py")], env=env).returncode
def main() -> None:
stage_repo()
stage_deps()
subprocess.run("pip install -q onnx_ir onnxscript", shell=True, check=False)
pull(WEIGHTS, MODEL)
pull(BUNDLE_REPO, BUNDLE, repo_type="dataset")
src = find_student()
if not src:
raise SystemExit("student4.pt not found — attach kkonda/webfm-train-voices as input")
dst = ROOT / "train"
dst.mkdir(parents=True, exist_ok=True)
shutil.copyfile(src, dst / "student4.pt")
print(f"using {src} ({os.path.getsize(src)/1e6:.0f} MB)")
print("== export + quantise ==", flush=True)
rc = run("export")
print("export rc", rc)
if rc != 0:
raise SystemExit("export/quantise failed")
print("== eval ==", flush=True)
rc = run("eval", {"EVAL_VOICES": EVAL_VOICES})
print("eval rc", rc)
if rc != 0:
raise SystemExit("eval failed")
if __name__ == "__main__":
main()
|