mandarin-tts icon indicating copy to clipboard operation
mandarin-tts copied to clipboard

Runtime Error: Error in loading state_dict for FastSpeech2

Open LifaSun opened this issue 3 years ago • 9 comments

@ranchlai 感谢分享!按照readme,一步一步运行会报错:

loading model from ./checkpoint/checkpoint_500000.pth Traceback (most recent call last): File "synthesize.py", line 123, in model = build_model().to(device) File "synthesize.py", line 50 in build_model model.load_state_dict(sd) File "/usr/local/lib/....../module.py, line 1224, in load_state_dict

Runtime Error: Error in loading state_dict for FastSpeech2

Miss key(s) in state_dict: "decoder.speaker_fc.weight" size mismatch for encoder.position_enc: copyinga param with shape torch.size([1, 10 01,256]) from checkpiont, the shape in current model is torch.size([1, 2001, 256])。 size mismatch for encoder.src_word_emb.weight: copying a param with shape torch.size ([1612,256])Erom checkpoint,the shape in current model is torch.size([1915,256])。 size mismatch for encoder.cn_word_emb.weight: copying a param with shape torch.size( [4135,2561)From checkpoint, the shape in current model is torch.size([4502,256])。 size mismatch for decoder.position_enc: copyinga param with shape torch.size([1, 10 01,2561) from checkpoint,the shape in current model is torch.size([1, 2001, 256])/content/

Thanks!

LifaSun avatar Apr 12 '21 15:04 LifaSun

please use this commit: c008dd766d4c72709864df6d41854b44ccf96eea git reset c008dd766d4c72709864df6d41854b44ccf96eea

ranchlai avatar Apr 15 '21 09:04 ranchlai

Thanks!

LifaSun avatar Apr 19 '21 07:04 LifaSun

碰到了同样的问题,没明白怎么修改?

cui7616 avatar Apr 22 '21 04:04 cui7616

Hey, I got the same issue. Can you tell me how to fix it. Thanks a lot.

loading model from ./checkpoint/checkpoint_500000.pth Traceback (most recent call last): File "synthesize.py", line 123, in model = build_model().to(device) File "synthesize.py", line 50, in build_model model.load_state_dict(sd) File "/home/jingjia/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1044, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for FastSpeech2: Missing key(s) in state_dict: "decoder.speaker_fc.weight". size mismatch for encoder.position_enc: copying a param with shape torch.Size([1, 1001, 256]) from checkpoint, the shape in current model is torch.Size([1, 2001, 256]). size mismatch for decoder.position_enc: copying a param with shape torch.Size([1, 1001, 256]) from checkpoint, the shape in current model is torch.Size([1, 2001, 256]).

zhibin86 avatar Apr 25 '21 06:04 zhibin86

大佬,我也到这个问题了。要怎么解决?

Yanshang1991 avatar Apr 25 '21 17:04 Yanshang1991

Sorry for late reply. I should fix this error by opening another branch for aishell3 (multispeaker with speaker embedding), but since I don't have enough time, a simple solution to this error is reset to the biaobei version

Solution:

git clone https://github.com/ranchlai/mandarin-tts.git
cd mandarin-tts
git reset c008dd766d4c72709864df6d41854b44ccf96eea --hard
python synthesize.py --input="您的电话余额不足,请及时充值"

It should work

ranchlai avatar Apr 26 '21 12:04 ranchlai

大佬,我也到这个问题了,麻烦 能不能说下 我咋直接 改代码,不知道原因是啥

lee9871 avatar Jun 17 '21 12:06 lee9871

旧版本:可使用biaobei分支:git checkout biaobei.

新版本:试试mtts分支,以后只维护这个分支。

ranchlai avatar Jun 18 '21 18:06 ranchlai

我也碰到了这个问题,而且用git reset c008dd7也找不到仓库,还有其他解决办法吗

YYouFuYuan avatar Aug 09 '21 03:08 YYouFuYuan