Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DepthAnythingV2Preprocessor Input type (MPSFloatType) and weight type (torch.FloatTensor) should be the same #493

Open
huongng105 opened this issue Dec 18, 2024 · 0 comments

Comments

@huongng105
Copy link

huongng105 commented Dec 18, 2024

DepthAnythingV2Preprocessor
Input type (MPSFloatType) and weight type (torch.FloatTensor) should be the same

2024-12-18T15:28:27.386212 - # 😺dzNodes: LayerStyle -> �[1;32mBrightness & Contrast Processed 1 image(s).�[m2024-12-18T15:28:27.386329 -
2024-12-18T15:28:27.400495 - # 😺dzNodes: LayerStyle -> �[1;32mBrightness & Contrast Processed 1 image(s).�[m2024-12-18T15:28:27.400581 -
2024-12-18T15:28:32.403894 - model_path is /opt/anaconda3/envs/ChangeX/ComfyUI/custom_nodes/comfyui_controlnet_aux/ckpts/depth-anything/Depth-Anything-V2-Large/depth_anything_v2_vitl.pth2024-12-18T15:28:32.404074 -
2024-12-18T15:28:32.406949 - using MLP layer as FFN
2024-12-18T15:28:34.659123 - !!! Exception during processing !!! Input type (MPSFloatType) and weight type (torch.FloatTensor) should be the same
2024-12-18T15:28:34.663847 - Traceback (most recent call last):
File "/opt/anaconda3/envs/ChangeX/ComfyUI/execution.py", line 328, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/ComfyUI/execution.py", line 203, in get_output_data
return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/ComfyUI/execution.py", line 174, in _map_node_over_list
process_inputs(input_dict, i)
File "/opt/anaconda3/envs/ChangeX/ComfyUI/execution.py", line 163, in process_inputs
results.append(getattr(obj, func)(**inputs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/ComfyUI/custom_nodes/comfyui_controlnet_aux/node_wrappers/depth_anything_v2.py", line 24, in execute
out = common_annotator_call(model, image, resolution=resolution, max_depth=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/ComfyUI/custom_nodes/comfyui_controlnet_aux/utils.py", line 85, in common_annotator_call
np_result = model(np_image, output_type="np", detect_resolution=detect_resolution, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/custom_controlnet_aux/depth_anything_v2/init.py", line 44, in call
depth = self.model.infer_image(cv2.cvtColor(input_image, cv2.COLOR_RGB2BGR), input_size=518, max_depth=max_depth)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/custom_controlnet_aux/depth_anything_v2/dpt.py", line 189, in infer_image
depth = self.forward(image, max_depth)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/custom_controlnet_aux/depth_anything_v2/dpt.py", line 179, in forward
features = self.pretrained.get_intermediate_layers(x, self.intermediate_layer_idx[self.encoder], return_class_token=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/custom_controlnet_aux/depth_anything_v2/dinov2.py", line 308, in get_intermediate_layers
outputs = self._get_intermediate_layers_not_chunked(x, n)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/custom_controlnet_aux/depth_anything_v2/dinov2.py", line 272, in _get_intermediate_layers_not_chunked
x = self.prepare_tokens_with_masks(x)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/custom_controlnet_aux/depth_anything_v2/dinov2.py", line 214, in prepare_tokens_with_masks
x = self.patch_embed(x)
^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/ComfyUI/custom_nodes/comfyui_controlnet_aux/src/custom_controlnet_aux/depth_anything_v2/dinov2_layers/patch_embed.py", line 76, in forward
x = self.proj(x) # B C H W
^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/lib/python3.12/site-packages/torch/nn/modules/conv.py", line 554, in forward
return self._conv_forward(input, self.weight, self.bias)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/ChangeX/lib/python3.12/site-packages/torch/nn/modules/conv.py", line 549, in _conv_forward
return F.conv2d(
^^^^^^^^^
RuntimeError: Input type (MPSFloatType) and weight type (torch.FloatTensor) should be the same

2024-12-18T15:28:34.666136 - Prompt executed in 9.03 seconds
Screenshot 2024-12-17 at 11 05 32
Screenshot 2024-12-17 at 11 06 49
Screenshot 2024-12-17 at 11 06 55
Screenshot 2024-12-17 at 11 07 03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant