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

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

Open
Snailgoo opened this issue Jul 8, 2024 · 1 comment

Comments

@Snailgoo
Copy link

Snailgoo commented Jul 8, 2024

python3 evaluation.py --test_dir testdata/ --model_path ckpt/D2Former_epoch_77_0.055 --save_dir saved_tracks_best
audio_path: testdata/noisy/p287_001_noisy.wav
Traceback (most recent call last):
File "/D2Former/evaluation.py", line 102, in
evaluation(args.model_path, noisy_dir, clean_dir, args.save_tracks, args.save_dir, out_file)
File "/D2Former/evaluation.py", line 72, in evaluation
est_audio, length = enhance_one_track(model, noisy_path, saved_dir, 16000*8, n_fft, n_fft//4, save_tracks)
File "/py310_audio/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/D2Former/evaluation.py", line 36, in enhance_one_track
noisy_spec = torch.stft(noisy, n_fft, hop, window=torch.hamming_window(n_fft).cuda(), onesided=True)
File "/py310_audio/lib/python3.10/site-packages/torch/functional.py", line 650, in stft
return _VF.stft(input, n_fft, hop_length, win_length, window, # type: ignore[attr-defined]
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.

@Snailgoo
Copy link
Author

Snailgoo commented Jul 8, 2024

follow the [Bug] RuntimeError: stft requires the return_complex parameter be given for real inputs #2449 [https://github.com/coqui-ai/TTS/issues/2449#top](coqui-ai/TTS#2449 (comment))
python3.10/site-packages/torch/functional.py:
at line 641:
insert this before return statement:
if not return_complex:
return torch.view_as_real(_VF.stft(input, n_fft, hop_length, win_length, window, # type: ignore[attr-defined]
normalized, onesided, return_complex=True))
and not worked, new bugs :
Traceback (most recent call last):
File "/D2Former/evaluation.py", line 102, in
evaluation(args.model_path, noisy_dir, clean_dir, args.save_tracks, args.save_dir, out_file)
File "/D2Former/evaluation.py", line 72, in evaluation
est_audio, length = enhance_one_track(model, noisy_path, saved_dir, 16000*8, n_fft, n_fft//4, save_tracks)
File "/py310_audio/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/D2Former/evaluation.py", line 42, in enhance_one_track
est_audio = torch.istft(est_spec_uncompress, n_fft, hop, window=torch.hamming_window(n_fft).cuda(),
RuntimeError: istft requires a complex-valued input tensor matching the output from stft with return_complex=True.

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

1 participant