m0_70001795 2023-05-19 05:18 采纳率: 100%
浏览 246
已结题

MockingBird社区分享的模型训练版本不一致

之前的问题我自己解决了,就是在文本里少打了个空格。
现在到最后一步了,又出现一个问题,我用MockingBird社区分享的模型训练报错,提示我模型和代码版本不一致,我该怎么修改版本?
这是模型名字,名字可能就是版本:pretrained-11-7-21_75k.pt

还有,我想用GPU训练,但是现在默认是CPU训练

Microsoft Windows [版本 10.0.19045.2965]
(c) Microsoft Corporation。保留所有权利。

H:\MockingBird>python pre.py H:\制作数据集 -d aidatatang_200zh -n 7
Using data from:
    H:\制作数据集\aidatatang_200zh\corpus\train
aidatatang_200zh: 100%|████████████████████████████████████████████████████████████| 1/1 [00:48<00:00, 48.27s/speakers]
The dataset consists of 283 utterances, 70584 mel frames, 14084160 audio timesteps (0.24 hours).
Max input length (text chars): 226
Max mel frames length: 833
Max audio timesteps length: 166560
Embedding:   0%|                                                                       | 0/283 [00:00<?, ?utterances/s]Loaded encoder "pretrained.pt" trained to step 1594501
Embedding: 100%|█████████████████████████████████████████████████████████████| 283/283 [00:09<00:00, 29.04utterances/s]

H:\MockingBird>python synthesizer_train.py xiyuetest H:\制作数据集\SV2TTS\synthesizer
Arguments:
    run_id:          xiyuetest
    syn_dir:         H:\制作数据集\SV2TTS\synthesizer
    models_dir:      synthesizer/saved_models/
    save_every:      1000
    backup_every:    25000
    log_every:       200
    force_restart:   False
    hparams:

Checkpoint path: synthesizer\saved_models\xiyuetest\xiyuetest.pt
Loading training data from: H:\制作数据集\SV2TTS\synthesizer\train.txt
Using model: Tacotron
Using device: cpu

Initialising Tacotron Model...

Trainable Parameters: 32.869M

Loading weights at synthesizer\saved_models\xiyuetest\xiyuetest.pt
Tacotron weights loaded from step 75000
Using inputs from:
        H:\制作数据集\SV2TTS\synthesizer\train.txt
        H:\制作数据集\SV2TTS\synthesizer\mels
        H:\制作数据集\SV2TTS\synthesizer\embeds
Found 283 samples
+----------------+------------+---------------+------------------+
| Steps with r=2 | Batch Size | Learning Rate | Outputs/Step (r) |
+----------------+------------+---------------+------------------+
|   85k Steps    |     12     |     5e-06     |        2         |
+----------------+------------+---------------+------------------+

H:\MockingBird\synthesizer\synthesizer_dataset.py:84: UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor. (Triggered internally at ..\torch\csrc\utils\tensor_new.cpp:248.)
  embeds = torch.tensor(embeds)
H:\MockingBird\synthesizer\synthesizer_dataset.py:84: UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor. (Triggered internally at ..\torch\csrc\utils\tensor_new.cpp:248.)
  embeds = torch.tensor(embeds)
Traceback (most recent call last):
  File "H:\MockingBird\synthesizer_train.py", line 37, in <module>
    train(**vars(args))
  File "H:\MockingBird\synthesizer\train.py", line 208, in train
    optimizer.step()
  File "C:\Users\Administrator.DESKTOP-6GOULRD\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\optim\optimizer.py", line 280, in wrapper
    out = func(*args, **kwargs)
  File "C:\Users\Administrator.DESKTOP-6GOULRD\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\optim\optimizer.py", line 33, in _use_grad
    ret = func(self, *args, **kwargs)
  File "C:\Users\Administrator.DESKTOP-6GOULRD\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\optim\adam.py", line 141, in step
    adam(
  File "C:\Users\Administrator.DESKTOP-6GOULRD\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\optim\adam.py", line 281, in adam
    func(params,
  File "C:\Users\Administrator.DESKTOP-6GOULRD\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\optim\adam.py", line 344, in _single_tensor_adam
    exp_avg.mul_(beta1).add_(grad, alpha=1 - beta1)
RuntimeError: The size of tensor a (1024) must match the size of tensor b (3) at non-singleton dimension 3

H:\MockingBird>

  • 写回答

8条回答 默认 最新

  • 「已注销」 2023-05-19 10:55
    关注

    引用chatgpt部分指引作答:
    根据你提供的信息,错误是在执行预处理脚本(pre.py)时出现的。错误信息表明在计算最大输入长度时出现了问题,因为max()函数的参数是一个空序列。

    错误发生在preprocess.py文件的第88行,这是在计算文本的最大长度。根据代码,该错误是因为metadata列表为空导致的。metadata是从文件中读取的音频文件的元数据列表。

    要解决这个问题,你可以检查以下几个方面:

    1 确保你提供的音频文件路径(H:\制作数据集\aidatatang_200zh\corpus\train\xy)中的音频文件存在,并且文件名与transcript文件中的音频文件名一致。
    2 确保你提供的文本文件路径(H:\制作数据集\aidatatang_200zh\transcript\aidatatang_200_zh_transcript.txt)中的文本文件存在,并且格式正确。
    3 确保文本文件中的每一行都包含正确的格式,例如"文件名+空格+文本"。
    4 检查aidatatang_200_zh_transcript.txt文件是否使用UTF-8编码保存。
    如果仍然遇到问题,建议逐行调试代码并输出相关变量的值,以确定问题出现的具体位置和原因。这样有助于进一步排除问题并解决错误。

    你可以把txt文档里的内容截图出来看看

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?

问题事件

  • 系统已结题 5月29日
  • 已采纳回答 5月21日
  • 赞助了问题酬金100元 5月21日
  • 修改了问题 5月20日
  • 展开全部