facebookresearch / facebookresearch/segment-anything

RuntimeError: Error(s) in loading state_dict for SamVitEncoder:

Open
#411 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
54.9k
Forks
6.4k
PR merge metrics
No merged PRs in 30d

Description

`size mismatch for pos_embed: copying a param with shape torch.Size([1, 64, 64, 1280]) from the checkpoint, the shape in the current model is a torch.Size([1, 4, 4, 1280]).`

@HannaMao I have been trying to fine-tune the Sam model, and while trying to load the model the following size error is popping out there is the same issue and u have closed that issue as completed. [link](https://github.com/facebookresearch/segment-anything/issues/39)
I dont know what my code is wrong.

here is the link to my code. [link](https://www.kaggle.com/code/sushmanthreddy0007/cell-nucleus-segmentor)

Screenshot 2023-06-01 at 8 21 59 PM

anyone pls help out, where i was going wrong?

Contributor guide

Open the contributing guide

Research direction

Start with the linked Kaggle notebook and its model-loading entry point. Compare the configured model and input or embedding dimensions with the checkpoint's pos_embed shape, then verify that loading the intended checkpoint completes without the reported size mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, pytorch
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.