训练时出错: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
Arguments:
run_id: mandarin
syn_dir: k:/mockingbird/datame/SV2TTS/synthesizer
models_dir: synthesizer/saved_models/
save_every: 1000
backup_every: 25000
log_every: 200
force_restart: False
hparams:
Checkpoint path: synthesizer\saved_models\mandarin\mandarin.pt
Loading training data from: k:\mockingbird\datame\SV2TTS\synthesizer\train.txt
Using model: Tacotron
Using device: cpu
Initialising Tacotron Model...
Trainable Parameters: 32.866M
Loading weights at synthesizer\saved_models\mandarin\mandarin.pt
Traceback (most recent call last):
File "synthesizer_train.py", line 37, in
train(**vars(args))
File "K:\MockingBird\synthesizer\train.py", line 114, in train
model.load(weights_fpath, optimizer)
File "K:\MockingBird\synthesizer\models\tacotron.py", line 536, in load
self.load_state_dict(checkpoint["model_state"], strict=False)
File "f:\anaconda3\envs\mockingbird\lib\site-packages\torch\nn\modules\module.py", line 1482, 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]).
size mismatch for decoder.stop_proj.weight: copying a param with shape torch.Size([1, 1536]) from checkpoint, the shape in current model is torch.Size([1, 2048]).
我已经把symbol里的那行字符改成旧版的那个了,还是报这个错。我这里用的是自己的数据,模仿aishell3的结构放了,已经做了 pre.py 的预处理,在开始训练这一步的时候就出了这个错
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with synthesizer/train.py and synthesizer/models/tacotron.py, especially the model.load call and the checkpoint dimensions shown in the traceback. Compare the saved mandarin.pt state_dict with the current Tacotron configuration and reproduce using the reported custom dataset setup; done means the cause of the dimension mismatch is identified and training either loads the checkpoint or reports a clear compatibility requirement.
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
- 30/100