run4: unpack cached traj, seed teacher, 8000 steps
Browse files- kaggle/train_voices.py +11 -0
kaggle/train_voices.py
CHANGED
|
@@ -171,6 +171,13 @@ def stage_traj() -> None:
|
|
| 171 |
def load_dataset():
|
| 172 |
import torch
|
| 173 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
zs, hs, ns, ls = [], [], [], []
|
| 175 |
for path in sorted(TRAJ.glob("*/*.pt")):
|
| 176 |
row = torch.load(path, map_location="cpu", weights_only=False)
|
|
@@ -373,6 +380,10 @@ def stage_eval() -> None:
|
|
| 373 |
for item in sents:
|
| 374 |
text = item["text"]
|
| 375 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
tw = tts.synthesize(task="TTS", text=text, language_id="Chinese",
|
| 377 |
prompt_wav_path=str(BUNDLE / v["wav"]),
|
| 378 |
prompt_text=v["prompt_text"], use_spk_emb=True,
|
|
|
|
| 171 |
def load_dataset():
|
| 172 |
import torch
|
| 173 |
|
| 174 |
+
cache = BUNDLE / "traj.zip"
|
| 175 |
+
if not any(TRAJ.glob("*/*.pt")) and cache.exists():
|
| 176 |
+
import zipfile
|
| 177 |
+
log(f"unpacking {cache} ({cache.stat().st_size // 1024 // 1024} MB)")
|
| 178 |
+
with zipfile.ZipFile(cache) as z:
|
| 179 |
+
z.extractall(ROOT / "train")
|
| 180 |
+
|
| 181 |
zs, hs, ns, ls = [], [], [], []
|
| 182 |
for path in sorted(TRAJ.glob("*/*.pt")):
|
| 183 |
row = torch.load(path, map_location="cpu", weights_only=False)
|
|
|
|
| 380 |
for item in sents:
|
| 381 |
text = item["text"]
|
| 382 |
try:
|
| 383 |
+
# Seed the teacher too: unseeded teacher sampling moved the
|
| 384 |
+
# baseline CER by ~2 pp between runs, which is the same size as
|
| 385 |
+
# the effect we are trying to measure.
|
| 386 |
+
torch.manual_seed(SEED)
|
| 387 |
tw = tts.synthesize(task="TTS", text=text, language_id="Chinese",
|
| 388 |
prompt_wav_path=str(BUNDLE / v["wav"]),
|
| 389 |
prompt_text=v["prompt_text"], use_spk_emb=True,
|