microsoft / unilm

Large-scale Self-supervised Pre-training Across Tasks, Languages, and Modalities
https://aka.ms/GeneralAI
MIT License
19.62k stars 2.5k forks source link

size mismatch for encoder.deit.pos_embed #978

Open dreamlychina opened 1 year ago

dreamlychina commented 1 year ago

Describe the bug Model I am using (trocr):

The problem arises when using:

A clear and concise description of what the bug is. RuntimeError: Error(s) in loading state_dict for TrOCRModel: size mismatch for encoder.deit.pos_embed: copying a param with shape torch.Size([1, 578, 384]) from checkpoint, the shape in current model is torch.Size([1, 577, 384]). the model is trocr and the checkpoints is the offical trocr-small-handwritten.pt

To Reproduce Steps to reproduce the behavior:

Expected behavior A clear and concise description of what you expected to happen.

domitix commented 1 year ago

Hi, I have this problem too. Have you solved it?