MockingBird_解决Fre-GAN训练时的报错

一.报错信息以及断点调试信息
1.报错信息
/data/cpf/Parrot_V3/vocoder/fregan/train.py:166: UserWarning: Using a target size (torch.Size([16, 80, 40])) that is different to the input size (torch.Size([16, 80, 32])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.
  loss_mel = F.l1_loss(y_mel, y_g_hat_mel) * 45
Traceback (most recent call last):
  File "vocoder_train.py", line 77, in
    train_fregan(0, args, h)
  File "/data/cpf/Parrot_V3/vocoder/fregan/train.py", line 166, in train
    loss_mel = F.l1_loss(y_mel, y_g_hat_mel) * 45
  File "/home/llp/.conda/envs/pytorch/lib/python3.8/site-packages/torch/nn/functional.py", line 3080, in l1_loss
    expanded_input, expanded_target = torch.broadcast_tensors(input, target)
  File "/home/llp/.conda/envs/pytorch/lib/python3.8/site-packages/torch/functional.py", line 72, in broadcast_tensors
    return _VF.broadcast_tensors(tensors)  # type: ignore[attr-defined]
RuntimeError: The size of tensor a (32) must match the size of tensor b (40) at non-singleton dimension 2
大概意思应该是y_mel和y_g_hat_mel的张量维度不相同
2.断点调试


(batch_size=1)
3.分析:问题定位到generator.py中函数FreGAN()的返回值上

二.解决方法
1.upsample_rates的乘积要等于hopsize,修改config中的内容为:
upsample_rates: [5,5,2,2,2],upsample_kernel_sizes: [10,10,4,4,4]
2.上卷积的时候padding的问题导致最后的维度对不上,代码修改如下:

三.参考知乎网址
1.细读经典:HiFiGAN,拥有多尺度和多周期判别器的高效声码器

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值