sh-lee-prml / HierSpeechpp

The official implementation of HierSpeech++
MIT License
1.17k stars 134 forks source link

inference error #31

Open liuyiheng001 opened 8 months ago

liuyiheng001 commented 8 months ago

I have trained on my own datasets, language is Chinese, and I use my own cleaners and symbols. However, when I use my trained model to infer tts( inference.py ), loading model has some errors like this:

File "/home/liuyiheng/HierSpeechpp/inference.py", line 157, in model_load text2w2v.load_state_dict(torch.load(a.ckpt_text2w2v)) File "/home/liuyiheng/HierSpeechpp/env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2041, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for SynthesizerTrn: Missing key(s) in state_dict: "enc_q.pre.weight", "enc_q.pre.bias", "enc_q.enc.in_layers.0.bias", "enc_q.enc.in_layers.0.weight_g",.... Unexpected key(s) in state_dict: "model", "iteration", "optimizer", "learning_rate".

Can you explain why this error occured? I only replace "ckpt_text2w2v" checkpoints to my trained checkpoints ,other checkpoints use yours' checkpoints . 微信图片_20240126091619

Is there anything else I should be aware of when infering tts?

Thank you very much for taking time out of your busy schedule to answer questions!

sh-lee-prml commented 8 months ago

Hi

Change your checkpoint loader as below

    _ = utils.load_checkpoint(a.ckpt_text2w2v, text2w2v, None)

We only share the model parameter in our checkpoint to reduce the file size.

Thanks