zhyever/PatchFusion

Pytorch 2 support

dlazares opened this issue · 3 comments

I was able to hack it to work by changing midas.py and using timm==0.6.12

+++ b/zoedepth/models/base_models/midas.py
@@ -170,7 +170,8 @@ class Resize(object):

     def __call__(self, x):
         width, height = self.get_size(*x.shape[-2:][::-1])
-        return nn.functional.interpolate(x, (height, width), mode='bilinear', align_corners=True)
+        return nn.functional.interpolate(x, (height.item(), width.item()), mode='bilinear', align_corners=True)

and also changed the cached model code at ~/.cache/torch/hub/intel-isl_MiDaS_master/midas/backbones/beit.py to
new_sub_table = F.interpolate(old_sub_table, size=(new_height.item(), new_width.item()), mode="bilinear")

is there a better way to do this?

mr-lab commented

in zoedepth\models\base_models\midas.py i changed the line 341:
midas = torch.hub.load("intel-isl/MiDaS", midas_model_type,
pretrained=use_pretrained_midas, force_reload=force_reload)

to :
midas = torch.hub.load("AyaanShah2204/MiDaS", midas_model_type,
pretrained=use_pretrained_midas, force_reload=force_reload)

We're currently doing something about this. Thanks for your interest!

Torch2.0 has been supported. Thanks