Skip to content

Size mismatch when using Meta’s officially released SAM-B model #24

Description

@ImageBlue

Nice work!
There's a size mismatch when I try to using Meta’s officially released SAM-B model, such as sam_vit_b_01ec64.pth. The error is like " size mismatch for image_encoder.blocks.0.attn.q.weight: copying a param with shape torch.Size([1024, 768]) from checkpoint, the shape in current model is torch.Size([768, 768]).
size mismatch for image_encoder.blocks.0.attn.q.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([768]).
size mismatch for image_encoder.blocks.0.attn.k.weight: copying a param with shape torch.Size([1024, 768]) from checkpoint, the shape in current model is torch.Size([768, 768]).
size mismatch for image_encoder.blocks.0.attn.k.bias: copying a param with shape torch.Size([1024]) from checkpoint, the shape in current model is torch.Size([768]).
size mismatch for image_encoder.blocks.0.attn.v.weight: copying a param with shape torch.Size([256, 768]) from checkpoint, the shape in current model is torch.Size([768, 768]).
size mismatch for image_encoder.blocks.0.attn.v.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([768])."
I have tried to run changepth.py and it succeessfully changed sam_vit_b_01ec64.pth into qkv one. I run prune_distill_step1.py and this error happen.
How to fix this error if I want to use SAM-B model like sam_vit_b_01ec64.pth?
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions