rishikksh20 / hifigan-denoiser

HiFi-GAN: High Fidelity Denoising and Dereverberation Based on Speech Deep Features in Adversarial Networks
Apache License 2.0
208 stars 45 forks source link

Tensorshape mismatch error when Postnet starts #8

Open SupreethRao99 opened 2 years ago

SupreethRao99 commented 2 years ago

Hello, I've been trying to train a model and when postnet starts I run into the following issue

Traceback (most recent call last):
  File "train.py", line 300, in <module>
    main()
  File "train.py", line 296, in main
    train(0, args, hp, hp_str)
  File "train.py", line 169, in train
    sc_loss_, mag_loss_ = stft_loss(y_g_hat[:, :, :y.size(2)].squeeze(1), y.squeeze(1))
  File "/home/guest/Supreeth/hifigan-denoiser/hifigan/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/guest/Supreeth/hifigan-denoiser/stft_loss.py", line 130, in forward
    sc_l, mag_l = f(x, y)
  File "/home/guest/Supreeth/hifigan-denoiser/hifigan/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/guest/Supreeth/hifigan-denoiser/stft_loss.py", line 91, in forward
    sc_loss = self.spectral_convergenge_loss(x_mag, y_mag)
  File "/home/guest/Supreeth/hifigan-denoiser/hifigan/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/guest/Supreeth/hifigan-denoiser/stft_loss.py", line 46, in forward
    return torch.norm(y_mag - x_mag, p="fro") / torch.norm(y_mag, p="fro")
RuntimeError: The size of tensor a (641) must match the size of tensor b (640) at non-singleton dimension 1

Is there a fix for this? thank you!

PengyvWANG commented 1 year ago

Hi, did you solve this problem? I also face the same Error

coreeey commented 1 year ago

Hi, did you solve this problem? I also face the same Error

Hello, I've been trying to train a model and when postnet starts I run into the following issue

Traceback (most recent call last):
  File "train.py", line 300, in <module>
    main()
  File "train.py", line 296, in main
    train(0, args, hp, hp_str)
  File "train.py", line 169, in train
    sc_loss_, mag_loss_ = stft_loss(y_g_hat[:, :, :y.size(2)].squeeze(1), y.squeeze(1))
  File "/home/guest/Supreeth/hifigan-denoiser/hifigan/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/guest/Supreeth/hifigan-denoiser/stft_loss.py", line 130, in forward
    sc_l, mag_l = f(x, y)
  File "/home/guest/Supreeth/hifigan-denoiser/hifigan/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/guest/Supreeth/hifigan-denoiser/stft_loss.py", line 91, in forward
    sc_loss = self.spectral_convergenge_loss(x_mag, y_mag)
  File "/home/guest/Supreeth/hifigan-denoiser/hifigan/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/guest/Supreeth/hifigan-denoiser/stft_loss.py", line 46, in forward
    return torch.norm(y_mag - x_mag, p="fro") / torch.norm(y_mag, p="fro")
RuntimeError: The size of tensor a (641) must match the size of tensor b (640) at non-singleton dimension 1

Is there a fix for this? thank you!