RuntimeError: Error(s) in loading state_dict for FastSpeech2
fangg2000 opened this issue · 1 comments
I saw it https://github.com/ming024/FastSpeech2/issues/32 the same problem, but I didn't mention the relevant reasons or solutions. I think I know the reason (I trained another model B with this project, and then I wanted to use the previous model A, which caused this problem. If this project can only use the latest trained model, how can the previously trained model be used?), but I don't know how to solve it. I hope someone can help me. Thank you very much.
Traceback (most recent call last): File "synthesize.py", line 188, in <module> model = get_model(args, configs, device, train=False) File "D:\workspace_tts\FastSpeech2-master\utils\model.py", line 21, in get_model model.load_state_dict(ckpt["model"], strict=False) File "C:\Users\xxx\Anaconda3\envs\pytorch_fs02\lib\site-packages\torch\nn\modules\module.py", line 1052, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for FastSpeech2: size mismatch for encoder.src_word_emb.weight: copying a param with shape torch.Size([603, 256]) from checkpoint, the shape in current model is torch.Size([412, 256]).
I see, the project I trained in the future did indeed change the pitch in pinyin. py. It seems that if I want to continue using the previous model , I can only find a way to introduce the pitch from the previous model into the current project.
我知道了,我后面训练的项目的确改了pinyin.py里面的音律,看来如果我还想使用之前的模型就只能想办法在当前的项目中引入之前模型里面的音律。