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

Getting RuntimeError: Error(s) in loading state_dict for ZoeDepth: #97

Open
devashish234073 opened this issue Dec 22, 2023 · 11 comments
Open

Comments

@devashish234073
Copy link

/bin/python3 /home/devashish/Desktop/ZoeDepth/depth.py img_size [384, 512] Using cache found in /home/devashish/.cache/torch/hub/intel-isl_MiDaS_master /home/devashish/.local/lib/python3.10/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3526.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] Params passed to Resize transform: width: 512 height: 384 resize_target: True keep_aspect_ratio: True ensure_multiple_of: 32 resize_method: minimal Using pretrained resource url::https://github.com/isl-org/ZoeDepth/releases/download/v1.0/ZoeD_M12_N.pt Traceback (most recent call last): File "/home/devashish/Desktop/ZoeDepth/depth.py", line 7, in <module> model_zoe_n = torch.hub.load(".", "ZoeD_N", source="local", pretrained=True) File "/home/devashish/.local/lib/python3.10/site-packages/torch/hub.py", line 566, in load model = _load_local(repo_or_dir, model, *args, **kwargs) File "/home/devashish/.local/lib/python3.10/site-packages/torch/hub.py", line 595, in _load_local model = entry(*args, **kwargs) File "/home/devashish/Desktop/ZoeDepth/./hubconf.py", line 69, in ZoeD_N model = build_model(config) File "/home/devashish/Desktop/ZoeDepth/./zoedepth/models/builder.py", line 51, in build_model return get_version(config.version_name).build_from_config(config) File "/home/devashish/Desktop/ZoeDepth/./zoedepth/models/zoedepth/zoedepth_v1.py", line 250, in build_from_config return ZoeDepth.build(**config) File "/home/devashish/Desktop/ZoeDepth/./zoedepth/models/zoedepth/zoedepth_v1.py", line 245, in build model = load_state_from_resource(model, pretrained_resource) File "/home/devashish/Desktop/ZoeDepth/./zoedepth/models/model_io.py", line 84, in load_state_from_resource return load_state_dict_from_url(model, url, progress=True) File "/home/devashish/Desktop/ZoeDepth/./zoedepth/models/model_io.py", line 61, in load_state_dict_from_url return load_state_dict(model, state_dict) File "/home/devashish/Desktop/ZoeDepth/./zoedepth/models/model_io.py", line 49, in load_state_dict model.load_state_dict(state) File "/home/devashish/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2152, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for ZoeDepth: Unexpected key(s) in state_dict: "core.core.pretrained.model.blocks.0.attn.relative_position_index", "core.core.pretrained.model.blocks.1.attn.relative_position_index", "core.core.pretrained.model.blocks.2.attn.relative_position_index", "core.core.pretrained.model.blocks.3.attn.relative_position_index", "core.core.pretrained.model.blocks.4.attn.relative_position_index", "core.core.pretrained.model.blocks.5.attn.relative_position_index", "core.core.pretrained.model.blocks.6.attn.relative_position_index", "core.core.pretrained.model.blocks.7.attn.relative_position_index", "core.core.pretrained.model.blocks.8.attn.relative_position_index", "core.core.pretrained.model.blocks.9.attn.relative_position_index", "core.core.pretrained.model.blocks.10.attn.relative_position_index", "core.core.pretrained.model.blocks.11.attn.relative_position_index", "core.core.pretrained.model.blocks.12.attn.relative_position_index", "core.core.pretrained.model.blocks.13.attn.relative_position_index", "core.core.pretrained.model.blocks.14.attn.relative_position_index", "core.core.pretrained.model.blocks.15.attn.relative_position_index", "core.core.pretrained.model.blocks.16.attn.relative_position_index", "core.core.pretrained.model.blocks.17.attn.relative_position_index", "core.core.pretrained.model.blocks.18.attn.relative_position_index", "core.core.pretrained.model.blocks.19.attn.relative_position_index", "core.core.pretrained.model.blocks.20.attn.relative_position_index", "core.core.pretrained.model.blocks.21.attn.relative_position_index", "core.core.pretrained.model.blocks.22.attn.relative_position_index", "core.core.pretrained.model.blocks.23.attn.relative_position_index".

@jackhawa
Copy link

Getting the same error.

2 similar comments
@Daniellli
Copy link

Getting the same error.

@dasda-asd
Copy link

Getting the same error.

@dasda-asd
Copy link

@thias15

@dasda-asd
Copy link

Has anyone encountered this issue? How should I resolve it? I would greatly appreciate it if you could respond.

@CDJdplus
Copy link

So do I and everyting was fine two weeks ago.

@rxjfighting
Copy link

run
pip install timm==0.6.7

@AldoPenaGa
Copy link

run pip install timm==0.6.7

This solved it! Thank you

@imruss
Copy link

imruss commented Apr 2, 2024

h

run pip install timm==0.6.7

have installed but still getting this zoedepth error, anyone else with a solution? :(

@Keith-Luo
Copy link

h

run pip install timm==0.6.7

have installed but still getting this zoedepth error, anyone else with a solution? :(

me too

@Leonever
Copy link

Leonever commented Apr 7, 2024

run pip install timm==0.6.7

Thank you very much, I have solved the issue with your solution.

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

10 participants