ZoeDepth icon indicating copy to clipboard operation
ZoeDepth copied to clipboard

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

Open devashish234073 opened this issue 1 year ago • 11 comments

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

devashish234073 avatar Dec 22 '23 05:12 devashish234073

Getting the same error.

jackhawa avatar Dec 22 '23 19:12 jackhawa

Getting the same error.

Daniellli avatar Dec 25 '23 04:12 Daniellli

Getting the same error.

dasda-asd avatar Dec 25 '23 13:12 dasda-asd

@thias15

dasda-asd avatar Dec 26 '23 02:12 dasda-asd

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

dasda-asd avatar Dec 26 '23 02:12 dasda-asd

So do I and everyting was fine two weeks ago.

CDJdplus avatar Dec 29 '23 06:12 CDJdplus

run pip install timm==0.6.7

rxjfighting avatar Dec 29 '23 17:12 rxjfighting

run pip install timm==0.6.7

This solved it! Thank you

AldoPenaGa avatar Dec 29 '23 18:12 AldoPenaGa

h

run pip install timm==0.6.7

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

imruss avatar Apr 02 '24 11:04 imruss

h

run pip install timm==0.6.7

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

me too

Keith-Luo avatar Apr 05 '24 12:04 Keith-Luo

run pip install timm==0.6.7

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

Leonever avatar Apr 07 '24 15:04 Leonever