Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: stft requires the return_complex parameter be given for real inputs, and will further require that return_complex=True in a future PyTorch release. #475

Open
finquick opened this issue Apr 4, 2023 · 3 comments

Comments

@finquick
Copy link

finquick commented Apr 4, 2023

Today there's an error occurred, what should I do? thanks!

Bug report

Describe the bug
RuntimeError: stft requires the return_complex parameter be given for real inputs, and will further require that return_complex=True in a future PyTorch release.

To Reproduce
import s3prl.hub as hub
import torch

model_0 = getattr(hub, 'fbank')() # use classic FBANK
model_1 = getattr(hub, 'modified_cpc')() # build the CPC model with pre-trained weights
model_2 = getattr(hub, 'tera')() # build the TERA model with pre-trained weights
model_3 = getattr(hub, 'wav2vec2')() # build the Wav2Vec 2.0 model with pre-trained weights

device = 'cpu' # or cpu
model_3 = model_3.to(device)
wavs = [torch.randn(160000, dtype=torch.float).to(device) for _ in range(16)]
with torch.no_grad():
reps = model_3(wavs)["hidden_states"]

Screenshots
If applicable, add screenshots to help explain your problem.
image

Environment
colab

@finquick
Copy link
Author

finquick commented Apr 4, 2023

pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117

This is due to the upgrade of PyTorch version to 2.0 in Colab, which has caused the issue. Currently, the most direct solution is to downgrade the version to 1.13, which can run normally. Can S3PRL be updated to adapt to PyTorch 2.0?

@popen8526
Copy link
Contributor

popen8526 commented Sep 10, 2023

@dlion168
I've encountered the same bug, and I use the following solution
coqui-ai/TTS#2449 (comment)
it works.

@CheeEn-Yu
Copy link

CheeEn-Yu commented Sep 11, 2023

@dlion168 I've encountered the same bug, I change the code at ./s3prl/s3prl/upstream/baseline/preprocessor.py
image
add the argument return_complex=False
Then it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants