File size: 1,219 Bytes
aee48fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""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()