zziang commited on
Commit
aee48fb
·
verified ·
1 Parent(s): c1cc38d

add notebook_mining.py

Browse files
Files changed (1) hide show
  1. kaggle/notebook_mining.py +35 -0
kaggle/notebook_mining.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Kaggle notebook body: mine prompt voices from DownFlow/ASMR.
2
+
3
+ Reuses the setup stages from notebook_eval so the env is identical. Then runs
4
+ voice_mining.py, which harvests 20 artists x 6 clips, re-transcribes each crop,
5
+ and ranks them by the teacher's CER with that clip as the prompt.
6
+
7
+ N_ARTISTS=20 N_PER_ARTIST=6 STAGE=harvest # cheap, CPU only
8
+ N_ARTISTS=20 N_PER_ARTIST=6 STAGE=probe # GPU, needs candidates.json
9
+ """
10
+ import os
11
+ import subprocess
12
+ import sys
13
+ from pathlib import Path
14
+
15
+ from notebook_eval import (BUNDLE, MODEL, REPO, ROOT, WEIGHTS, pull,
16
+ stage_deps, stage_repo)
17
+
18
+ BUNDLE_REPO = "idefinity/webfm-eval"
19
+
20
+
21
+ def main() -> None:
22
+ stage_repo()
23
+ stage_deps()
24
+ subprocess.run("pip install -q datasets soundfile", shell=True, check=False)
25
+ pull(WEIGHTS, MODEL)
26
+ pull(BUNDLE_REPO, BUNDLE, repo_type="dataset")
27
+
28
+ env = dict(os.environ, WORK_ROOT=str(ROOT), STAGE=os.environ.get("STAGE", "all"))
29
+ rc = subprocess.run([sys.executable, str(BUNDLE / "kaggle/voice_mining.py")], env=env).returncode
30
+ print(f"voice_mining exit={rc}")
31
+ print("artifacts: voices/candidates.json, voices/probe.json, voices/best.json")
32
+
33
+
34
+ if __name__ == "__main__":
35
+ main()