diff --git a/apps/stable_diffusion/src/utils/stencils/zoe/__init__.py b/apps/stable_diffusion/src/utils/stencils/zoe/__init__.py index fb70b82149..fbf299e4f8 100644 --- a/apps/stable_diffusion/src/utils/stencils/zoe/__init__.py +++ b/apps/stable_diffusion/src/utils/stencils/zoe/__init__.py @@ -30,9 +30,15 @@ def __init__(self): pretrained=False, force_reload=False, ) - model.load_state_dict( - torch.load(modelpath, map_location=model.device)["model"] - ) + + # Hack to fix the ZoeDepth import issue + model_keys = model.state_dict().keys() + loaded_dict = torch.load(modelpath, map_location=model.device)["model"] + loaded_keys = loaded_dict.keys() + for key in loaded_keys - model_keys: + loaded_dict.pop(key) + + model.load_state_dict(loaded_dict) model.eval() self.model = model