Skip to content

Commit 06de9eb

Browse files
fix: remove nan values
1 parent bd66b9b commit 06de9eb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

audio_separator/separator/architectures/vr_separator.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ def postprocess(mask, X_mag, X_phase):
317317
return y_spec, v_spec
318318

319319
def spec_to_wav(self, spec):
320+
# Check if the spec contains only finite values
321+
if not np.isfinite(spec).all():
322+
self.logger.error("Spectrogram contains non-finite values. Attempting to fix.")
323+
spec = np.nan_to_num(spec) # Replace NaN and infinite values with zero (consider if appropriate for your case)
324+
320325
if self.high_end_process and isinstance(self.input_high_end, np.ndarray) and self.input_high_end_h:
321326
input_high_end_ = spec_utils.mirroring("mirroring", spec, self.input_high_end, self.model_params)
322327
wav = spec_utils.cmb_spectrogram_to_wave(spec, self.model_params, self.input_high_end_h, input_high_end_, is_v51_model=self.is_vr_51_model)

0 commit comments

Comments
 (0)