From 004ea63f62a4ae497bc60840c3ab67c45ff0a7db Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Sun, 5 Apr 2026 22:44:04 +0200 Subject: [PATCH] fix: fall back to soundfile for torchaudio.save when torchcodec unavailable Same torchcodec/FFmpeg issue as the load path, now on the eval sample save. Co-Authored-By: Claude Sonnet 4.6 --- nodes/selva_lora_trainer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nodes/selva_lora_trainer.py b/nodes/selva_lora_trainer.py index bc443fe..3dca384 100644 --- a/nodes/selva_lora_trainer.py +++ b/nodes/selva_lora_trainer.py @@ -508,7 +508,11 @@ class SelvaLoraTrainer: dataset, seq_cfg, device, dtype) if wav is not None: wav_path = output_dir / f"sample_step{step:05d}.wav" - torchaudio.save(str(wav_path), wav, sr) + try: + torchaudio.save(str(wav_path), wav, sr) + except RuntimeError: + import soundfile as sf + sf.write(str(wav_path), wav.squeeze(0).numpy(), sr) print(f"[LoRA Trainer] Sample saved: {wav_path}", flush=True) pbar_train.update(1)