isl-org / MiDaS

Code for robust monocular depth estimation described in "Ranftl et. al., Towards Robust Monocular Depth Estimation: Mixing Datasets for Zero-shot Cross-dataset Transfer, TPAMI 2022"
MIT License
4.25k stars 597 forks source link

Compatibility with latest timm and torch #234

Open AyaanShah2204 opened 11 months ago

AyaanShah2204 commented 11 months ago

Torch Compatibility

We're working with the latest nightly version of torch. They seem to have added type asserts to interpolate (this commit).

This causes a runtime error because the size we pass in is of type numpy.int32. A simple int-cast should fix this without any side effects.

Timm compatibility

Blocks.drop_path() was deprecated and replaced with Blocks.drop_path1() and Blocks.drop_path2() in this commit. This has been causing a runtime error referenced in this issue.

This has affected things downstream in ZoeDepth and Auto1111's controlnet extension.

semjon00 commented 10 months ago

Thank you, this would fix https://github.com/thygate/stable-diffusion-webui-depthmap-script/issues/319

@dwofk could you please merge this?

semjon00 commented 10 months ago

@thias15 These are quite necessary changes. Could you please merge this?

nagadomi commented 10 months ago

This change does not work with timm==0.6.12 installed on existing systems. lllyasviel's fix works with both timm==0.6.12 and timm==0.9.5. https://github.com/Mikubill/sd-webui-controlnet/pull/2001 (In MiDas setup, drop_path is actually Identity(), so there is no need to worry about drop_path1 or drop_path2. )

AyaanShah2204 commented 10 months ago

@nagadomi I can change the PR to match lllyasviel's fix. I was under the assumption that this was the only issue preventing systems from updating to the latest timm.

semjon00 commented 10 months ago

@AyaanShah2204 I think that would be great to support both timm==0.6.12 and timm==0.9.5