ocrbook/ocrinaction

使用train训练出来的模型在demo中加载失败

Opened this issue · 1 comments

RuntimeError: Error(s) in loading state_dict for CRNN:
size mismatch for rnn.0.rnn.weight_ih_l0: copying a param with shape torch.Size([512, 512]) from checkpoint, the shape in current model is torch.Size([1024, 512]).
size mismatch for rnn.0.rnn.weight_hh_l0: copying a param with shape torch.Size([512, 128]) from checkpoint, the shape in current model is torch.Size([1024, 256]).
size mismatch for rnn.0.rnn.bias_ih_l0: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for rnn.0.rnn.bias_hh_l0: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for rnn.0.rnn.weight_ih_l0_reverse: copying a param with shape torch.Size([512, 512]) from checkpoint, the shape in current model is torch.Size([1024, 512]).
size mismatch for rnn.0.rnn.weight_hh_l0_reverse: copying a param with shape torch.Size([512, 128]) from checkpoint, the shape in current model is torch.Size([1024, 256]).
size mismatch for rnn.0.rnn.bias_ih_l0_reverse: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for rnn.0.rnn.bias_hh_l0_reverse: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for rnn.0.embedding.weight: copying a param with shape torch.Size([77, 256]) from checkpoint, the shape in current model is torch.Size([37, 512]).
size mismatch for rnn.0.embedding.bias: copying a param with shape torch.Size([77]) from checkpoint, the shape in current model is torch.Size([37]).

他这上面说的是训练出来的模型的参数与demo中初始化的模型的参数数量都不匹配,我就纳闷了,都是用的同一个crnn网络训练,怎么就不匹配了?