ibcplateformes Claude Opus 4.6 commited on
Commit
2f6540c
·
1 Parent(s): db1a474

Fix inference tensor backward error: add torch.no_grad + inference_mode

Browse files

BigVGAN vocoder fails with 'Inference tensors cannot be saved for backward'
when called without proper gradient context. Add @torch .no_grad() and
@torch .inference_mode() decorators matching official Seed-VC implementation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. pipeline/inference.py +2 -0
pipeline/inference.py CHANGED
@@ -255,6 +255,8 @@ def convert_voice(
255
  raise
256
 
257
 
 
 
258
  def _convert_voice_impl(audio_path, reference_path, pitch, index_rate, diffusion_steps):
259
  """Actual conversion implementation (called from GPU-decorated wrapper)."""
260
  import soundfile as sf
 
255
  raise
256
 
257
 
258
+ @torch.no_grad()
259
+ @torch.inference_mode()
260
  def _convert_voice_impl(audio_path, reference_path, pitch, index_rate, diffusion_steps):
261
  """Actual conversion implementation (called from GPU-decorated wrapper)."""
262
  import soundfile as sf