训练的时候出问题 RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for Tacotron:
- Dominant language
- Python
- Stars
- 36.9k
- Forks
- 5.2k
- PR merge metrics
- No merged PRs in 30d
Description
执行命令
python synthesizer_train.py mandarin {自己的路径}\SV2TTS\synthesizer
当
_characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!\'(),-.:;? '
报错
File "synthesizer_train.py", line 37, in
train(**vars(args))
File "D:\ai\MockingBird-main\MockingBird-main\synthesizer\train.py", line 122, in train
model.load(weights_fpath, device, optimizer)
File "D:\ai\MockingBird-main\MockingBird-main\synthesizer\models\tacotron.py", line 548, in load
self.load_state_dict(checkpoint["model_state"], strict=False)
File "D:\Anaconda3\envs\MB\lib\site-packages\torch\nn\modules\module.py", line 1497, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Tacotron:
size mismatch for encoder.embedding.weight: copying a param with shape torch.Size([70, 512]) from checkpoint, the shape in current model is torch.Size([75, 512]).
size mismatch for encoder_proj.weight: copying a param with shape torch.Size([128, 512]) from checkpoint, the shape in current model is torch.Size([128, 1024]).
当
_characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!\'(),-.:;? '
报错
File "synthesizer_train.py", line 37, in
train(**vars(args))
File "D:\ai\MockingBird-main\MockingBird-main\synthesizer\train.py", line 122, in train
model.load(weights_fpath, device, optimizer)
File "D:\ai\MockingBird-main\MockingBird-main\synthesizer\models\tacotron.py", line 548, in load
self.load_state_dict(checkpoint["model_state"], strict=False)
File "D:\Anaconda3\envs\MB\lib\site-packages\torch\nn\modules\module.py", line 1497, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Tacotron:
size mismatch for encoder_proj.weight: copying a param with shape torch.Size([128, 512]) from checkpoint, the shape in current model is torch.Size([128, 1024]).
size mismatch for decoder.attn_rnn.weight_ih: copying a param with shape torch.Size([384, 768]) from checkpoint, the shape in current model is torch.Size([384, 1280]).
改
use_gst = False, 和 use_ser_for_gst = False,
报错
File "synthesizer_train.py", line 37, in
train(**vars(args))
File "D:\ai\MockingBird-main\MockingBird-main\synthesizer\train.py", line 122, in train
model.load(weights_fpath, device, optimizer)
File "D:\ai\MockingBird-main\MockingBird-main\synthesizer\models\tacotron.py", line 548, in load
self.load_state_dict(checkpoint["model_state"], strict=False)
File "D:\Anaconda3\envs\MB\lib\site-packages\torch\nn\modules\module.py", line 1497, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Tacotron:
size mismatch for encoder_proj.weight: copying a param with shape torch.Size([128, 512]) from checkpoint, the shape in current model is torch.Size([128, 1024]).
size mismatch for decoder.attn_rnn.weight_ih: copying a param with shape torch.Size([384, 768]) from checkpoint, the shape in current model is torch.Size([384, 1280]).
size mismatch for decoder.rnn_input.weight: copying a param with shape torch.Size([1024, 640]) from checkpoint, the shape in current model is torch.Size([1024, 1152]).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with synthesizer/train.py at line 122 and synthesizer/models/tacotron.py at line 548, then reproduce the reported command and inspect the checkpoint dimensions against the current Tacotron settings, including _characters and GST options. Done means the reported checkpoint loads without the listed size-mismatch errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100