thygate / stable-diffusion-webui-depthmap-script

High Resolution Depth Maps for Stable Diffusion WebUI
MIT License
1.73k stars 159 forks source link

New Midas Models wont load #405

Open cmore86 opened 9 months ago

cmore86 commented 9 months ago

The new 3.1 models download but then wont load on the standalone. The work fine here on 1111

DepthMap v0.4.4 (5250c8b7) device: cuda Loading model(s) .. Loading model weights from ./models/midas/dpt_beit_large_512.pt Fail.

Traceback (most recent call last): File "/mnt/c/Users/john/OneDrive/Desktop/webui-depthmap-standalone/src/common_ui.py", line 526, in run_generate input_i, type, result = next(gen_obj) ^^^^^^^^^^^^^ File "/mnt/c/Users/john/OneDrive/Desktop/webui-depthmap-standalone/src/core.py", line 322, in core_generation_funnel raise e File "/mnt/c/Users/john/OneDrive/Desktop/webui-depthmap-standalone/src/core.py", line 124, in core_generation_funnel model_holder.ensure_models(inp[go.MODEL_TYPE], device, inp[go.BOOST]) File "/mnt/c/Users/john/OneDrive/Desktop/webui-depthmap-standalone/src/depthmap_generation.py", line 67, in ensure_models self.load_models(model_type, device, boost) File "/mnt/c/Users/john/OneDrive/Desktop/webui-depthmap-standalone/src/depthmap_generation.py", line 110, in load_models model = DPTDepthModel( ^^^^^^^^^^^^^^ File "/mnt/c/Users/john/OneDrive/Desktop/webui-depthmap-standalone/dmidas/dpt_depth.py", line 163, in init self.load(path) File "/mnt/c/Users/john/OneDrive/Desktop/webui-depthmap-standalone/dmidas/base_model.py", line 16, in load self.load_state_dict(parameters) File "/home/john/miniforge3/envs/depth/lib/python3.11/site-packages/torch/nn/modules/module.py", line 2153, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for DPTDepthModel: Unexpected key(s) in state_dict: "pretrained.model.blocks.0.attn.relative_position_index", "pretrained.model.blocks.1.attn.relative_position_index", "pretrained.model.blocks.2.attn.relative_position_index", "pretrained.model.blocks.3.attn.relative_position_index", "pretrained.model.blocks.4.attn.relative_position_index", "pretrained.model.blocks.5.attn.relative_position_index", "pretrained.model.blocks.6.attn.relative_position_index", "pretrained.model.blocks.7.attn.relative_position_index", "pretrained.model.blocks.8.attn.relative_position_index", "pretrained.model.blocks.9.attn.relative_position_index", "pretrained.model.blocks.10.attn.relative_position_index", "pretrained.model.blocks.11.attn.relative_position_index", "pretrained.model.blocks.12.attn.relative_position_index", "pretrained.model.blocks.13.attn.relative_position_index", "pretrained.model.blocks.14.attn.relative_position_index", "pretrained.model.blocks.15.attn.relative_position_index", "pretrained.model.blocks.16.attn.relative_position_index", "pretrained.model.blocks.17.attn.relative_position_index", "pretrained.model.blocks.18.attn.relative_position_index", "pretrained.model.blocks.19.attn.relative_position_index", "pretrained.model.blocks.20.attn.relative_position_index", "pretrained.model.blocks.21.attn.relative_position_index", "pretrained.model.blocks.22.attn.relative_position_index", "pretrained.model.blocks.23.attn.relative_position_index".

syanatan1997 commented 9 months ago

Try install timm 0.6.7 version pip install timm==0.6.7

If the above does not resolve the issue, you may also need to downgrade pytorch 2.0.0 https://github.com/isl-org/ZoeDepth/issues/86