zziang commited on
Commit
7ae7149
·
verified ·
1 Parent(s): 2eeec3c

eval: load student after freeing teacher, a08 only

Browse files
Files changed (1) hide show
  1. kaggle/train_voices.py +8 -3
kaggle/train_voices.py CHANGED
@@ -343,9 +343,6 @@ def stage_eval() -> None:
343
  mm = tts.model
344
  device = next(mm.parameters()).device
345
  teacher = mm.flowloss.cfm.model.float().eval()
346
- student = copy.deepcopy(teacher)
347
- student.load_state_dict(state)
348
- student = student.to(device).eval()
349
 
350
  asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-small",
351
  device=0, torch_dtype=torch.float16)
@@ -390,6 +387,14 @@ def stage_eval() -> None:
390
  del teacher
391
  torch.cuda.empty_cache()
392
 
 
 
 
 
 
 
 
 
393
  # Pass 2: student only, reusing the teacher audio for frame count.
394
  for v in sel:
395
  latent, spk = tts.prepare_prompt(str(BUNDLE / v["wav"]), use_spk_emb=True)
 
343
  mm = tts.model
344
  device = next(mm.parameters()).device
345
  teacher = mm.flowloss.cfm.model.float().eval()
 
 
 
346
 
347
  asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-small",
348
  device=0, torch_dtype=torch.float16)
 
387
  del teacher
388
  torch.cuda.empty_cache()
389
 
390
+ # Pass 2: student only. Load it here, not alongside the teacher: two DiTs
391
+ # plus the 1.48 B backbone do not fit in 15 GB.
392
+ import copy as _copy
393
+
394
+ student = _copy.deepcopy(mm.flowloss.cfm.model.float())
395
+ student.load_state_dict(state)
396
+ student = student.to(device).eval()
397
+
398
  # Pass 2: student only, reusing the teacher audio for frame count.
399
  for v in sel:
400
  latent, spk = tts.prepare_prompt(str(BUNDLE / v["wav"]), use_spk_emb=True)