ZoeDepth
ZoeDepth copied to clipboard
Hacky way to run ZoeDepth with modern timm (e.g. timm==0.9.8)
Instead of
import torch
repo = "isl-org/ZoeDepth"
model_zoe_nk = torch.hub.load(repo, "ZoeD_NK", pretrained=True)
Run the following monkey-patching code:
import torch
import torch.nn as nn
repo = "isl-org/ZoeDepth"
model_zoe_nk = torch.hub.load(repo, "ZoeD_NK", pretrained=False)
pretrained_dict = torch.hub.load_state_dict_from_url('https://github.com/isl-org/ZoeDepth/releases/download/v1.0/ZoeD_M12_NK.pt', map_location='cpu')
model_zoe_nk.load_state_dict(pretrained_dict['model'], strict=False)
for b in model_zoe_nk.core.core.pretrained.model.blocks:
b.drop_path = nn.Identity()
Tested with timm==0.9.8
I'm getting an error running this:
"name 'nn' is not defined"
OK, this is working for me with:
import torch
repo = "isl-org/ZoeDepth"
model_zoe_nk = torch.hub.load(repo, "ZoeD_NK", pretrained=False)
pretrained_dict = torch.hub.load_state_dict_from_url('https://github.com/isl-org/ZoeDepth/releases/download/v1.0/ZoeD_M12_NK.pt', map_location='cpu')
model_zoe_nk.load_state_dict(pretrained_dict['model'], strict=False)
for b in model_zoe_nk.core.core.pretrained.model.blocks:
b.drop_path = torch.nn.Identity()
@decamun thanks for the catch, I forgot import torch.nn as nn
. Your solution is works as well, obviously.
Hey @ducha-aiki, any chance you know of a workaround for the issue I'm having in #84?