I testing a tacotron2 trained model but getting an error. Here are the code and errors.
checkpoint_path = "tacotron2_statedict.pt"
model = load_model(hparams)
model.load_state_dict(torch.load(checkpoint_path)['state_dict'])
_ = model.cuda().eval().half()
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[9], line 3
1 checkpoint_path = "tacotron2_statedict.pt"
2 model = load_model(hparams)
----> 3 model.load_state_dict(torch.load(checkpoint_path)['state_dict'])
4 _ = model.cuda().eval().half()
File ~\anaconda3\envs\TTS\Lib\site-packages\torch\nn\modules\module.py:2153, in Module.load_state_dict(self, state_dict, strict, assign)
2148 error_msgs.insert(
2149 0, 'Missing key(s) in state_dict: {}. '.format(
2150 ', '.join(f'"{k}"' for k in missing_keys)))
2152 if len(error_msgs) > 0:
-> 2153 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
2154 self.__class__.__name__, "\n\t".join(error_msgs)))
2155 return _IncompatibleKeys(missing_keys, unexpected_keys)
RuntimeError: Error(s) in loading state_dict for Tacotron2:
size mismatch for embedding.weight: copying a param with shape torch.Size([148, 512]) from checkpoint, the shape in current model is torch.Size([313, 512]).
Previously I had an error with Setup hparams and solved the problem following this link. HParams was removed from tensorflow 2.0I don't know if this is related or not.(I'm new to this and this is my first question.)help me.
All libraries in requirements.txt are Latest version.
python==3.11 pytorch==2.2.1+cu118