luoyily / MoeTTS

Speech synthesis model /inference GUI repo for galgame characters based on Tacotron2, Hifigan, VITS and Diff-svc
GNU General Public License v3.0
974 stars 79 forks source link

用自己的模型预测时出现错误 #22

Closed zzhbb2002 closed 1 year ago

zzhbb2002 commented 2 years ago

C:/Users/zzh/Desktop/default.pth C:/Users/zzh/Desktop Exception in Tkinter callback Traceback (most recent call last): File "tkinter__init.py", line 1705, in call File "moe_tts_cpu_tool.py", line 365, in File "moe_tts_cpu_tool.py", line 181, in inference_vitss File "vits\utils.py", line 40, in load_checkpoint File "torch\nn\modules\module.py", line 1605, in load_state_dict self.class.name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for SynthesizerTrn: size mismatch for enc_p.emb.weight: copying a param with shape torch.Size([178, 192]) from checkpoint, the shape in current model is torch.Size([40, 192]). 用网络上的非官方vits训练的中文模型 请问一下在模型训练时应该做些什么修改吗

luoyily commented 2 years ago

尝试使用新版并配置符号(即moetts.json),可参考readme教程配置

zzhbb2002 commented 2 years ago

pad = '' _punctuation = ';:,.!?¡¿—…"«»“” ' _punctuation_zh = ';:,。!?-“”《》、()BP…—~.\·『』・ ' _letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' _numbers = '1234567890' _others = '' _letters_ipa = "ɑɐɒæɓʙβɔɕçɗɖðʤəɘɚɛɜɝɞɟʄɡɠɢʛɦɧħɥʜɨɪʝɭɬɫɮʟɱɯɰŋɳɲɴøɵɸθœɶʘɹɺɾɻʀʁɽʂʃʈʧʉʊʋⱱʌɣɤʍχʎʏʑʐʒʔʡʕʢǀǁǂǃˈˌːˑʼʴʰʱʲʷˠˤ˞↓↑→↗↘'̩'ᵻ" symbols = [_pad] + list(_punctuation) + list(_letters) + list(_letters_ipa) symbols_zh = [_pad] + list(_punctuation_zh) + list(_letters) + list(_numbers) SPACE_ID = symbols.index(" ") 模型应该是通过symbol zh训练的,但读取模型时提示的字符数量却是symbol的字符数量,这种存在两个symbol的情况该怎么办呢

luoyily commented 2 years ago

将你模型使用的符号写入配置即可,参考 (readme-模型目录格式)https://github.com/luoyily/MoeTTS#%E6%A8%A1%E5%9E%8B%E7%9B%AE%E5%BD%95%E6%A0%BC%E5%BC%8F

zzhbb2002 commented 2 years ago

写入symbol时,可以正常运行,但无法正常说话。 写入symbol_zh时,提示size mismatch for enc_p.emb.weight: copying a param with shape torch.Size([178, 192]) from checkpoint, the shape in current model is torch.Size([78, 192]). 训练时是使用的中文拼音,即symbol_zh训练。

zzhbb2002 commented 1 year ago

问题解决了,将text文件替换一下便可正常预测