fix(bigvgan-trainer): clone target tensor to exit inference mode before backward

Clips loaded outside torch.inference_mode(False) are inference tensors.
Autograd cannot save them for backward. .clone() creates a normal tensor,
same fix pattern as selva_lora_trainer's dist.mode().clone().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-09 01:47:47 +02:00
parent 16e20b30ce
commit daa36a5f7b
+1 -1
View File
@@ -232,7 +232,7 @@ class SelvaBigvganTrainer:
start = random.randint(0, clip.shape[0] - segment_samples)
batch.append(clip[start : start + segment_samples])
target_flat = torch.stack(batch).to(device, dtype) # [B, T]
target_flat = torch.stack(batch).to(device, dtype).clone() # [B, T]
target_wav = target_flat.unsqueeze(1) # [B, 1, T]
# Fixed target mel (no grad needed here)