spectrogram-inversion icon indicating copy to clipboard operation
spectrogram-inversion copied to clipboard

module 'torch' has no attribute 'irfft

Open anujndoshi opened this issue 4 years ago • 3 comments

When running the example file on Colab with GPU it raises the error.

Downloading file 'Kevin_MacLeod_-Vibe_Ace.hq.ogg' from 'https://librosa.org/data/audio/Kevin_MacLeod-_Vibe_Ace.hq.ogg' to '/root/.cache/librosa'. /usr/local/lib/python3.7/dist-packages/torch/functional.py:581: UserWarning: stft will soon require the return_complex parameter be given for real inputs, and will further require that return_complex=True in a future PyTorch release. (Triggered internally at /pytorch/aten/src/ATen/native/SpectralOps.cpp:639.) normalized, onesided, return_complex)

AttributeError Traceback (most recent call last) in () 16 mag = mag.cuda() 17 ---> 18 yhat = griffin_lim(mag, maxiter=100, alpha=0.3, window=window) 19 20 # check convergence

1 frames /usr/local/lib/python3.7/dist-packages/torch_specinv/methods.py in _istft(x, n_fft, win_length, window, hop_length, center, normalized, onesided, synth_coeff, offset, ola_weight) 88 A helper function to do istft. 89 """ ---> 90 x = torch.irfft(x.transpose(0, 1), 1, normalized=normalized, onesided=onesided, 91 signal_sizes=[n_fft] if onesided else None)[:, offset:offset + win_length] 92

AttributeError: module 'torch' has no attribute 'irfft'

anujndoshi avatar May 01 '21 19:05 anujndoshi

Same issue here.

Downgrading to torch version 1.6.0. comes with older CUDA versions that are not compatible with the required versions for the RTX3090 GPU. Pytorch 1.8 would be oldest version that runs the right CUDA for this hardware but also gives the same error.

Is there a fix planned for this?

BenjaminHavenaar avatar Jan 20 '22 10:01 BenjaminHavenaar

AttributeError: module 'torch' has no attribute 'rfft' with PyTorch https://stackoverflow.com/questions/67647299/attributeerror-module-torch-has-no-attribute-rfft-with-pytorch

use torch.fft.rfft instead of torch.rfft.

HIN0209 avatar Apr 06 '23 00:04 HIN0209

Sorry, I missed this issue for a long time. The problem is fixed in the latest version, but I haven't uploaded it to pypi yet. I'll add relevant CICD for this soon. The temporary solution is to install it from GitHub:

pip install git+https://github.com/yoyololicon/spectrogram-inversion

yoyolicoris avatar Jul 25 '23 09:07 yoyolicoris