随笔 - 165,  文章 - 0,  评论 - 4,  阅读 - 17887

一.报错信息以及断点调试信息
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,拥有多尺度和多周期判别器的高效声码器

posted on   孜孜不倦fly  阅读(1004)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示