dvector icon indicating copy to clipboard operation
dvector copied to clipboard

Can not reshape tensor due visualization

Open Vadim2S opened this issue 4 years ago • 1 comments

I am run visualization and get error:

[INFO] model loaded. Preprocess: 1% 12/889 [00:00<00:27, 31.83it/s] Traceback (most recent call last): File "visualize.py", line 89, in visualize(**vars(PARSER.parse_args())) File "visualize.py", line 43, in visualize mel_tensor = wav2mel(wav_tensor, sample_rate) File "/home/vvs/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) RuntimeError: The following operation failed in the TorchScript interpreter. Traceback of TorchScript, serialized code (most recent call last): File "code/torch/data/wav2mel.py", line 20, in forward sample_rate: int) -> Tensor: wav_tensor0 = (self.sox_effects).forward(wav_tensor, sample_rate, ) mel_tensor = (self.log_melspectrogram).forward(wav_tensor0, ) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE return mel_tensor

.....

Traceback of TorchScript, original code (most recent call last): File "/home/yist/.pyenv/versions/3.8.5/lib/python3.8/site-packages/torchaudio/transforms.py", line 96, in forward Fourier bins, and time is the number of window hops (n_frame). """ return F.spectrogram( ~~~~~~~~~~~~~ <--- HERE waveform, self.pad, File "/home/yist/.pyenv/versions/3.8.5/lib/python3.8/site-packages/torchaudio/functional/functional.py", line 88, in spectrogram # pack batch shape = waveform.size() waveform = waveform.reshape(-1, shape[-1]) ~~~~~~~~~~~~~~~~ <--- HERE

# default values are consistent with librosa.core.spectrum._spectrogram

RuntimeError: cannot reshape tensor of 0 elements into shape [-1, 0] because the unspecified dimension size -1 can be any value and is ambiguous

Vadim2S avatar Oct 19 '21 13:10 Vadim2S

Did you solve this problem? I met with this problem too.

chonghaozhang1998 avatar Dec 29 '21 16:12 chonghaozhang1998