Skip to content

size mismatch for encoder.deit.pos_embed #978

@dreamlychina

Description

@dreamlychina

Describe the bug
Model I am using (trocr):

The problem arises when using:

  • the official example scripts: (give details below)
    python pic_inference.py

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:
1.
2.
3.

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

  • Platform:
  • Python version: 3.8.3
  • PyTorch version (GPU?): 1.13.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions