Skip to content

权重加载问题 #89

Description

@AI4S-Ritsuka

在test.py中,使用百度云上的pth权重时:
parser.add_argument("--sam_checkpoint", type=str, default="/home/Medical/other_models/SAM-Med2D-main/sam-med2d_b.pth", help="sam checkpoint")
显示权重不匹配:
size mismatch for image_encoder.pos_embed: copying a param with shape torch.Size([1, 16, 16, 768]) from checkpoint, the shape in current model is torch.Size([1, 32, 32, 768]).
size mismatch for image_encoder.blocks.2.attn.rel_pos_h: copying a param with shape torch.Size([31, 64]) from checkpoint, the shape in current model is torch.Size([63, 64]).
size mismatch for image_encoder.blocks.2.attn.rel_pos_w: copying a param with shape torch.Size([31, 64]) from checkpoint, the shape in current model is torch.Size([63, 64]).
size mismatch for image_encoder.blocks.5.attn.rel_pos_h: copying a param with shape torch.Size([31, 64]) from checkpoint, the shape in current model is torch.Size([63, 64]).
size mismatch for image_encoder.blocks.5.attn.rel_pos_w: copying a param with shape torch.Size([31, 64]) from checkpoint, the shape in current model is torch.Size([63, 64]).
size mismatch for image_encoder.blocks.8.attn.rel_pos_h: copying a param with shape torch.Size([31, 64]) from checkpoint, the shape in current model is torch.Size([63, 64]).
size mismatch for image_encoder.blocks.8.attn.rel_pos_w: copying a param with shape torch.Size([31, 64]) from checkpoint, the shape in current model is torch.Size([63, 64]).
size mismatch for image_encoder.blocks.11.attn.rel_pos_h: copying a param with shape torch.Size([31, 64]) from checkpoint, the shape in current model is torch.Size([63, 64]).
size mismatch for image_encoder.blocks.11.attn.rel_pos_w: copying a param with shape torch.Size([31, 64]) from checkpoint, the shape in current model is torch.Size([63, 64]).
请问这里如何解决,是哪里的参数设置有问题吗?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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