maum-ai / nuwave2

NU-Wave 2: A General Neural Audio Upsampling Model for Various Sampling Rates @ INTERSPEECH 2022
https://mindslab-ai.github.io/nuwave2
BSD 3-Clause "New" or "Revised" License
272 stars 21 forks source link

when i run inference.py script an error occurs #15

Open ghost opened 1 year ago

ghost commented 1 year ago

2023-08-02 12:00:07.518068: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT /usr/local/lib/python3.10/dist-packages/torch/functional.py:641: UserWarning: stft with return_complex=False is deprecated. In a future pytorch release, stft will return complex tensors for all inputs, and return_complex=False will raise an error. Note: you can still call torch.view_as_real on the complex output to recover the old return format. (Triggered internally at ../aten/src/ATen/native/SpectralOps.cpp:862.) return _VF.stft(input, n_fft, hop_length, win_length, window, # type: ignore[attr-defined] Traceback (most recent call last): File "/content/nuwave2/inference.py", line 115, in wav_recon, wav_list = model.inference(wav_l, band, args.steps, noise_schedule) File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, kwargs) File "/content/nuwave2/lightning_model.py", line 50, in inference signal, recon = self.model.denoise_ddim(signal, wav_l, band, logsnr_t, logsnr_s) File "/content/nuwave2/diffusion.py", line 54, in denoise_ddim noise = self.model(y, y_l, band, norm_nlogsnr) File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, *kwargs) File "/content/nuwave2/model.py", line 215, in forward x, skip_connection = layer(x, band, noise_level) File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(args, kwargs) File "/content/nuwave2/model.py", line 173, in forward y_l, y_g = self.ffc1(y_l, y_g, band) # STFC File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, kwargs) File "/content/nuwave2/model.py", line 153, in forward out_xg = self.convl2g(x_l) + self.convg2g(x_g, band) File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, *kwargs) File "/content/nuwave2/model.py", line 125, in forward output = self.fu(x, band) File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(args, kwargs) File "/content/nuwave2/model.py", line 105, in forward output = torch.istft(ffted, self.n_fft, hop_length=self.hop_size, win_length=self.win_size, window=self.hann_window, RuntimeError: istft requires a complex-valued input tensor matching the output from stft with return_complex=True.

Please any one can resolve this issue for me , thanks in advance

youyouta123 commented 3 weeks ago

I also encountered the same problem. Have you solved it?

youhjjhhhjj commented 2 weeks ago

it's caused by the pytorch version

fix by putting torch.view_as_complex(ffted) on line 105 of model.py will also need to uncomment return_complex=False on utils/stft.py