Skip to content

Cannot load MiDaS model DPT_SwinV2_T_256 from hub #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
shaibagon opened this issue Apr 9, 2025 · 0 comments
Open

Cannot load MiDaS model DPT_SwinV2_T_256 from hub #357

shaibagon opened this issue Apr 9, 2025 · 0 comments

Comments

@shaibagon
Copy link

I am trying to use MiDaS (github.com/isl-org/MiDaS) from hub:

midas = torch.hub.load("intel-isl/MiDaS", "DPT_SwinV2_T_256")

I am getting the following error:

RuntimeError: Error(s) in loading state_dict for DPTDepthModel:
        Missing key(s) in state_dict: "pretrained.model.layers.3.downsample.reduction.weight", "pretrained.model.layers.3.downsample.norm.weight", >     "pretrained.model.layers.3.downsample.norm.bias", "pretrained.model.head.fc.weight", "pretrained.model.head.fc.bias".
        Unexpected key(s) in state_dict: "pretrained.model.layers.0.downsample.reduction.weight", "pretrained.model.layers.0.downsample.norm.weight", "pretrained.model.layers.0.downsample.norm.bias", "pretrained.model.layers.0.blocks.1.attn_mask", "pretrained.model.layers.1.blocks.1.attn_mask", "pretrained.model.head.weight", "pretrained.model.head.bias".
        size mismatch for pretrained.model.layers.1.downsample.reduction.weight: copying a param with shape torch.Size([384, 768]) from checkpoint, the shape in current model is torch.Size([192, 384]).
        size mismatch for pretrained.model.layers.1.downsample.norm.weight: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([192]).
        size mismatch for pretrained.model.layers.1.downsample.norm.bias: copying a param with shape torch.Size([384]) from checkpoint, the shape in current model is torch.Size([192]).
        size mismatch for pretrained.model.layers.2.downsample.reduction.weight: copying a param with shape torch.Size([768, 1536]) from checkpoint, the shape in current model is torch.Size([384, 768]).
        size mismatch for pretrained.model.layers.2.downsample.norm.weight: copying a param with shape torch.Size([768]) from checkpoint, the shape in current model is torch.Size([384]).
        size mismatch for pretrained.model.layers.2.downsample.norm.bias: copying a param with shape torch.Size([768]) from checkpoint, the shape in current model is torch.Size([384]).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant