comfyui_controlnet_aux: Error occurred when executing Zoe-DepthMapPreprocessor

Running this on Mac OS with MPS support in nightly Pytorch.

!!! Exception during processing !!!
Traceback (most recent call last):
  File "~/ComfyUI/execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "~/ComfyUI/execution.py", line 81, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "~/ComfyUI/execution.py", line 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "~/ComfyUI/custom_nodes/comfyui_controlnet_aux/node_wrappers/zoe.py", line 18, in execute
    return (common_annotator_call(model, image), )
  File "~/ComfyUI/custom_nodes/comfyui_controlnet_aux/utils.py", line 28, in common_annotator_call
    np_result = model(np_image, output_type="numpy", **kwargs)
  File "~/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/controlnet_aux/zoe/__init__.py", line 56, in __call__
    depth = self.model.infer(image_depth)
  File "~/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/controlnet_aux/zoe/zoedepth/models/depth_model.py", line 126, in infer
    return self.infer_with_flip_aug(x, pad_input=pad_input, **kwargs)
  File "~/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/controlnet_aux/zoe/zoedepth/models/depth_model.py", line 110, in infer_with_flip_aug
    out = self._infer_with_pad_aug(x, pad_input=pad_input, **kwargs)
  File "~/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/controlnet_aux/zoe/zoedepth/models/depth_model.py", line 88, in _infer_with_pad_aug
    out = self._infer(x)
  File "~/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/controlnet_aux/zoe/zoedepth/models/depth_model.py", line 55, in _infer
    return self(x)['metric_depth']
  File "~/.pyenv/versions/comfyui/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "~/.pyenv/versions/comfyui/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "~/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/controlnet_aux/zoe/zoedepth/models/zoedepth/zoedepth_v1.py", line 144, in forward
    rel_depth, out = self.core(x, denorm=denorm, return_rel_depth=True)
  File "~/.pyenv/versions/comfyui/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "~/.pyenv/versions/comfyui/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "~/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/controlnet_aux/zoe/zoedepth/models/base_models/midas.py", line 263, in forward
    x = self.prep(x)
  File "~/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/controlnet_aux/zoe/zoedepth/models/base_models/midas.py", line 187, in __call__
    return self.normalization(self.resizer(x))
  File "~/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/controlnet_aux/zoe/zoedepth/models/base_models/midas.py", line 174, in __call__
    return nn.functional.interpolate(x, (height, width), mode='bilinear', align_corners=True)
  File "~/.pyenv/versions/comfyui/lib/python3.10/site-packages/torch/nn/functional.py", line 3926, in interpolate
    raise TypeError(
TypeError: expected size to be one of int or Tuple[int] or Tuple[int, int] or Tuple[int, int, int], but got size with types [<class 'numpy.int64'>, <class 'numpy.int64'>]

I have no idea if this is related but noticed that in: custom_nodes/comfyui_controlnet_aux/node_wrappers/zoe.py

it can’t import import controlnet_aux

More likely I’m thinking this must have something to do with the way torch is casting integers.

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 22 (6 by maintainers)

Commits related to this issue

Most upvoted comments

this also happens on linux/cuda

to fix this: file /comfyui_controlnet_aux/src/controlnet_aux/zoe/zoedepth/models/base_models/midas.py replace line 176 with

return nn.functional.interpolate(x, (int(height), int(width)), mode='bilinear', align_corners=True)

file /comfyui_controlnet_aux/src/custom_midas_repo/midas/backbones/beit.py replace line 47 with

new_sub_table = F.interpolate(old_sub_table, size=(int(new_height), int(new_width)), mode="bilinear")

PR #71 pushed

Up to date as of earlier this evening and receiving pretty much the same issue `Error occurred when executing Zoe-DepthMapPreprocessor:

expected size to be one of int or Tuple[int] or Tuple[int, int] or Tuple[int, int, int], but got size with types [, ]

File “F:\ComfyUI\execution.py”, line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File “F:\ComfyUI\execution.py”, line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File “F:\ComfyUI\execution.py”, line 74, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) File “F:\ComfyUI\custom_nodes\comfyui_controlnet_aux\node_wrappers\zoe.py”, line 18, in execute return (common_annotator_call(model, image), ) File “F:\ComfyUI\custom_nodes\comfyui_controlnet_aux\utils.py”, line 28, in common_annotator_call np_result = model(np_image, output_type=“numpy”, **kwargs) File “F:\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\zoe_init_.py”, line 56, in call depth = self.model.infer(image_depth) File “F:\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\zoe\zoedepth\models\depth_model.py”, line 126, in infer return self.infer_with_flip_aug(x, pad_input=pad_input, **kwargs) File “F:\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\zoe\zoedepth\models\depth_model.py”, line 110, in infer_with_flip_aug out = self._infer_with_pad_aug(x, pad_input=pad_input, **kwargs) File “F:\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\zoe\zoedepth\models\depth_model.py”, line 88, in _infer_with_pad_aug out = self._infer(x) File “F:\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\zoe\zoedepth\models\depth_model.py”, line 55, in _infer return self(x)[‘metric_depth’] File “F:\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py”, line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File “F:\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py”, line 1527, in _call_impl return forward_call(*args, **kwargs) File “F:\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\zoe\zoedepth\models\zoedepth\zoedepth_v1.py”, line 144, in forward rel_depth, out = self.core(x, denorm=denorm, return_rel_depth=True) File “F:\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py”, line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File “F:\ComfyUI\venv\lib\site-packages\torch\nn\modules\module.py”, line 1527, in _call_impl return forward_call(*args, **kwargs) File “F:\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\zoe\zoedepth\models\base_models\midas.py”, line 263, in forward x = self.prep(x) File “F:\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\zoe\zoedepth\models\base_models\midas.py”, line 187, in call return self.normalization(self.resizer(x)) File “F:\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\zoe\zoedepth\models\base_models\midas.py”, line 174, in call return nn.functional.interpolate(x, (height, width), mode=‘bilinear’, align_corners=True) File “F:\ComfyUI\venv\lib\site-packages\torch\nn\functional.py”, line 3926, in interpolate raise TypeError(`

pytorch is also up to date on the nightly channel, using cuda 12.1 and bf16 flag in comfy

to fix this

Your fix worked for me. Thanks.