tedi-resemble commited on
Commit
28b93aa
·
1 Parent(s): 48d32ab

Fix voice-ref denoise crash when mamba_ssm is missing

Browse files

The existing try/except only wrapped REUSEUpsampler construction, but the
mamba_ssm import is deferred to _lazy_load() which fires from __call__.
So construction silently succeeded, the session sentinel was never set,
and the first generate request blew up with ModuleNotFoundError.

Wrap the __call__ site too. Trip the sentinel and return the original
voice unmodified - same fallback semantics as the construction failure.

Files changed (1) hide show
  1. src/inference_server.py +10 -1
src/inference_server.py CHANGED
@@ -292,7 +292,16 @@ class TTSServer:
292
  mono = mono.contiguous()
293
 
294
  t0 = time.time()
295
- cleaned, _ = self._ref_denoiser(mono, in_sr=int(voice.sampling_rate))
 
 
 
 
 
 
 
 
 
296
  if cleaned.dim() == 2 and cleaned.shape[0] == 1:
297
  cleaned = cleaned[0]
298
  # Restore the (1, C=1, T) shape that the rest of the pipeline expects
 
292
  mono = mono.contiguous()
293
 
294
  t0 = time.time()
295
+ try:
296
+ cleaned, _ = self._ref_denoiser(mono, in_sr=int(voice.sampling_rate))
297
+ except (ImportError, ModuleNotFoundError, RuntimeError) as e:
298
+ # Lazy-load inside __call__ can still raise on missing mamba_ssm /
299
+ # selective_scan_cuda kernels even though construction succeeded
300
+ # (REUSEUpsampler defers the import to first call). Trip the
301
+ # session-wide sentinel so subsequent calls skip cheaply.
302
+ logging.warning(f"Voice-ref denoise disabled mid-call (RE-USE unavailable: {e})")
303
+ self._ref_denoiser = False
304
+ return voice
305
  if cleaned.dim() == 2 and cleaned.shape[0] == 1:
306
  cleaned = cleaned[0]
307
  # Restore the (1, C=1, T) shape that the rest of the pipeline expects