Skip to content
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

Errors during operation for the model swin2t16_256 #236

Open
sjanbs opened this issue Aug 17, 2023 · 4 comments
Open

Errors during operation for the model swin2t16_256 #236

sjanbs opened this issue Aug 17, 2023 · 4 comments

Comments

@sjanbs
Copy link

sjanbs commented Aug 17, 2023

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".

@gene-walt
Copy link

gene-walt commented Oct 8, 2023

You have both "missing keys" and "unexpected keys", I was getting the just unexpected keys trying to use the dpt_beit_large_512 model.

What do you see if you edit base_model.py to print all the keys? Are those keys missing?

for key in parameters:
    print(key)

Because I had unexpected keys, I simply deleted all the bad keys before calling load_state_dict.
But then I ran into another issue: isl-org/ZoeDepth#26

@wgqt1zl
Copy link

wgqt1zl commented Oct 22, 2023

You have both "missing keys" and "unexpected keys", I was getting the just unexpected keys trying to use the dpt_beit_large_512 model.

What do you see if you edit base_model.py to print all the keys? Are those keys missing?

for key in parameters:
    print(key)

Because I had unexpected keys, I simply deleted all the bad keys before calling load_state_dict. But then I ran into another issue: isl-org/ZoeDepth#26

hello have you solved the problem?

@gene-walt
Copy link

You have both "missing keys" and "unexpected keys", I was getting the just unexpected keys trying to use the dpt_beit_large_512 model.
What do you see if you edit base_model.py to print all the keys? Are those keys missing?

for key in parameters:
    print(key)

Because I had unexpected keys, I simply deleted all the bad keys before calling load_state_dict. But then I ran into another issue: isl-org/ZoeDepth#26

hello have you solved the problem?

I have MiDaS working with dpt 512.

I haven’t made any pull request since I’m guessing my issue is related to my personal Windows environment. I think most ppl are running on Mac? After manually deleting keys to get around the “unexpected” key issue, I also had to change my “timm” module version inside of the environment file (isl-org/ZoeDepth#26)

This won’t help GitHub issue though as the error says “missing keys”.

@Waving-Flag
Copy link

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".

It seems that the versions of your imutils and timm Python libraries might be too high. You can try lowering their versions according to the specifications in the environment.yaml file. That's how I resolved a similar issue.

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

4 participants