Mockingbird_替换vocoder为Fre-GAN

本文介绍了如何移植和训练Fre-GAN声码器模型,包括参考论文、项目源码、训练指令以及遇到的维度不匹配问题的解决。详细步骤涉及vocoder_train.py的模型选择、fregan模块的代码修改、config.json的参数配置以及UI界面的模型加载。在训练过程中,使用了hifigan的预训练模型,并给出了具体的训练指令。在实际操作中遇到了因输入频谱尺寸不一致导致的错误,但已成功解决。
摘要由CSDN通过智能技术生成

一.参考论文以及项目源码
1.知乎网址:语音合成论文优选:Fre-GAN: Adversarial Frequency-consistent Audio Synthesis
2.github项目源码:二.移植模块具体代码
1.vocodr_train.py中:选择需要训练的预训练模型

2.fregan/train.py和meldataset中:
(1)导入文件作相应修改
(2)对照hifigan中代码修改(添加#等)
3.在config.json中对训练参数进行配置,重点关注对输入频谱的处理函数传入参数
4.fregan文件夹下添加inference.py
5.在ui界面中加载预训练的fregan模型三.训练声码器模型
1.github作者教程
2.实际操作:
训练指令为:

hifigan:
预训练:python vocoder_preprocess.py F:\机器学习\实践\AI语音克隆\data -m F:\机器学习\实践\AI语音克隆\Parrot_V2\synthesizer\saved_models\fly_4_110k
python vocoder_train.py myvo F:\机器学习\实践\AI语音克隆\data hifigan


fregan:
python vocoder_train.py myvo F:\机器学习\实践\AI语音克隆\data --config config.json freganPS:本次Fre-GAN声码器的移植在训练时出现报错且已解决!
/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的张量维度不相同

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值