BadCafeCode / masquerade-nodes-comfyui

A powerful set of mask-related nodes for ComfyUI
MIT License
348 stars 34 forks source link

Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! #14

Open yovsac opened 11 months ago

yovsac commented 11 months ago

Get this error:

Error occurred when executing Cut By Mask:

Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument tensors in method wrapper_CUDA_cat)

File "C:\IA\ComfyUI_windows_portable_03\ComfyUI_windows_portable\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\IA\ComfyUI_windows_portable_03\ComfyUI_windows_portable\ComfyUI\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\IA\ComfyUI_windows_portable_03\ComfyUI_windows_portable\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\IA\ComfyUI_windows_portable_03\ComfyUI_windows_portable\ComfyUI\custom_nodes\masquerade-nodes-comfyui\MaskNodes.py", line 702, in cut image = tensor2rgba(image) ^^^^^^^^^^^^^^^^^^ File "C:\IA\ComfyUI_windows_portable_03\ComfyUI_windows_portable\ComfyUI\custom_nodes\masquerade-nodes-comfyui\MaskNodes.py", line 68, in tensor2rgba return torch.cat((t, alpha_tensor), dim=3) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Any ideas on how to solve it? It happens when I connect a color transfer node to a "cut by mask node". Any workarounds would be welcomed.

osen77 commented 8 months ago

same here Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument tensors in method wrapper_CUDA_cat)

filip-nikacevic commented 6 months ago

Seems to be an issue with ComfyI2I using both the CUDA device and CPU. I found a workaround by using an Images to RGB node between the Color Transfer and Cut by Mask.

yovsac commented 6 months ago

Thank you! I’ll check that out!