melgan-neurips icon indicating copy to clipboard operation
melgan-neurips copied to clipboard

Problem in changing sample rate into 16k Hz

Open xuexidi opened this issue 4 years ago • 3 comments

Hi! Thanks for your code!

When I train the model in the sample rate of 22.05k Hz,and keep the other params the same with your given params. Every thing goes well.

But,when I tried to modified the sample rate to 16k Hz the configration is: sr:16k Hz n_fft:800 hop_legth:200 win_length:800

when I started trainning, I got this warning: train.py:187: UserWarning: Using a target size (torch.Size([64, 80, 51])) that is different to the input size (torch.Size([64, 80, 40])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.

And an error occured: Traceback (most recent call last): File "train.py", line 284, in train_melgan() File "train.py", line 187, in train_melgan s_error = F.l1_loss(s_t, s_pred_t).item() File "/home/pxdevice/anaconda3/envs/oneshot/lib/python3.6/site-packages/torch/nn/functional.py", line 2616, in l1_loss expanded_input, expanded_target = torch.broadcast_tensors(input, target) File "/home/pxdevice/anaconda3/envs/oneshot/lib/python3.6/site-packages/torch/functional.py", line 65, in broadcast_tensors return _VF.broadcast_tensors(tensors) RuntimeError: The size of tensor a (40) must match the size of tensor b (51) at non-singleton dimension 2

I have no idea to fix this error,should I modify the structure params of Generator network? Could you please help me, please!

xuexidi avatar Nov 16 '20 09:11 xuexidi

Hi, you can make target and input last dimension(dim=2) the same size

allenhung1025 avatar Jan 22 '21 15:01 allenhung1025

Hi, you can make target and input last dimension(dim=2) the same size

@allenhung1025 Where is this adjustment required to be made? I'm experiencing the same issue

RussellSB avatar Apr 17 '21 14:04 RussellSB

@RussellSB Hi, for Example, if the target size is (torch.Size([64, 80, 51])) and the input size is (torch.Size([64, 80, 40])), you can compute loss between target[:, :, :40] and input.

allenhung1025 avatar Apr 18 '21 06:04 allenhung1025