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

Shape doesn't match when inferencing Wavegram_Logmel_Cnn14 model #59

Open
LllHan opened this issue May 24, 2023 · 1 comment
Open

Shape doesn't match when inferencing Wavegram_Logmel_Cnn14 model #59

LllHan opened this issue May 24, 2023 · 1 comment

Comments

@LllHan
Copy link

LllHan commented May 24, 2023

Hi,
I used my own pre-trained Wavegram_Logmel_Cnn14 model to inference.py file with the following error:

Traceback (most recent call last):
  File "test.py", line 948, in <module>
    audio_tagging(args)
  File "test.py", line 892, in audio_tagging
    batch_output_dict = model(waveform, None)
  File "/root/miniconda3/envs/sed/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/root/miniconda3/envs/sed/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 159, in forward
    return self.module(*inputs[0], **kwargs[0])
  File "/root/miniconda3/envs/sed/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "test.py", line 563, in forward
    x = torch.cat((x, a1), dim=1)
RuntimeError: Sizes of tensors must match except in dimension 2. Got 68 and 69 (The offending index is 0)
@lbroad-tm
Copy link

This happens because or round/flooring that occurs in when creating the wavegrams and spectrograms, try interpolating your inputs onto different grids - for instance I got an error when my input was (60, 220500), but not for (60, 180000).

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

2 participants