webfm-eval / kaggle /notebook_mining.py
zziang's picture
add notebook_mining.py
aee48fb verified
Raw History Blame Contribute Delete
1.22 kB
"""Kaggle notebook body: mine prompt voices from DownFlow/ASMR.
Reuses the setup stages from notebook_eval so the env is identical. Then runs
voice_mining.py, which harvests 20 artists x 6 clips, re-transcribes each crop,
and ranks them by the teacher's CER with that clip as the prompt.
N_ARTISTS=20 N_PER_ARTIST=6 STAGE=harvest # cheap, CPU only
N_ARTISTS=20 N_PER_ARTIST=6 STAGE=probe # GPU, needs candidates.json
"""
import os
import subprocess
import sys
from pathlib import Path
from notebook_eval import (BUNDLE, MODEL, REPO, ROOT, WEIGHTS, pull,
stage_deps, stage_repo)
BUNDLE_REPO = "idefinity/webfm-eval"
def main() -> None:
stage_repo()
stage_deps()
subprocess.run("pip install -q datasets soundfile", shell=True, check=False)
pull(WEIGHTS, MODEL)
pull(BUNDLE_REPO, BUNDLE, repo_type="dataset")
env = dict(os.environ, WORK_ROOT=str(ROOT), STAGE=os.environ.get("STAGE", "all"))
rc = subprocess.run([sys.executable, str(BUNDLE / "kaggle/voice_mining.py")], env=env).returncode
print(f"voice_mining exit={rc}")
print("artifacts: voices/candidates.json, voices/probe.json, voices/best.json")
if __name__ == "__main__":
main()