Expected all tensors to be on the same device, but got tensors is on cpu, different from other tensors on cuda:0 (when checking argument in method wrapper_CUDA_cat)
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
### Custom Node Testing
- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)
### Expected Behavior
ZImageFunControlnet
Expected all tensors to be on the same device, but got tensors is on cpu, different from other tensors on cuda:0 (when checking argument in method wrapper_CUDA_cat)
#### System Information
- **ComfyUI Version:** 0.5.1
- **Arguments:** main.py --listen --fast --reserve-vram 0 --gpu-only --verbose DEBUG
- **OS:** linux
- **Python Version:** 3.12.12 | packaged by conda-forge | (main, Oct 22 2025, 23:25:55) [GCC 14.3.0]
- **Embedded Python:** false
- **PyTorch Version:** 2.9.1+cu128
#### Devices
- **Name:** cuda:0 NVIDIA L40 : native
- **Type:** cuda
- **VRAM Total:** 47665709056
- **VRAM Free:** 46730706944
- **Torch VRAM Total:** 23068672
- **Torch VRAM Free:** 14548992
### Actual Behavior
### Steps to Reproduce
### Debug Logs
```powershell
2025-12-19T11:32:02.181091 - !!! Exception during processing !!! Expected all tensors to be on the same device, but got tensors is on cpu, different from other tensors on cuda:0 (when checking argument in method wrapper_CUDA_cat)
2025-12-19T11:32:02.181926 - Traceback (most recent call last):
File "/ComfyUI/execution.py", line 516, in execute
output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/execution.py", line 330, in get_output_data
return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/execution.py", line 304, in _async_map_node_over_list
await process_inputs(input_dict, i)
File "/ComfyUI/execution.py", line 292, in process_inputs
result = f(**inputs)
^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 461, in diffsynth_controlnet
patch = ZImageControlPatch(model_patch, vae, image, strength, inpaint_image=inpaint_image, mask=mask)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 326, in __init__
self.encoded_image = self.encode_latent_cond(self.image, self.inpaint_image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 356, in encode_latent_cond
return torch.cat([latent_image, mask_, inpaint_image_latent], dim=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Expected all tensors to be on the same device, but got tensors is on cpu, different from other tensors on cuda:0 (when checking argument in method wrapper_CUDA_cat)
2025-12-19T11:32:02.182777 - Prompt executed in 19.24 seconds
2025-12-19T11:32:02.771381 - # PS: PS not connected2025-12-19T11:32:02.771421 -
2025-12-19T11:32:02.807850 - # PS: PS not connected2025-12-19T11:32:02.807888 -
2025-12-19T11:33:29.274522 - got prompt
2025-12-19T11:33:29.276814 - Using selector: EpollSelector
2025-12-19T11:33:29.352741 - # PS: PS not connected2025-12-19T11:33:29.352786 -
2025-12-19T11:33:29.490518 - !!! Exception during processing !!! Expected all tensors to be on the same device, but got tensors is on cpu, different from other tensors on cuda:0 (when checking argument in method wrapper_CUDA_cat)
2025-12-19T11:33:29.491199 - Traceback (most recent call last):
File "/ComfyUI/execution.py", line 516, in execute
output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/execution.py", line 330, in get_output_data
return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/execution.py", line 304, in _async_map_node_over_list
await process_inputs(input_dict, i)
File "/ComfyUI/execution.py", line 292, in process_inputs
result = f(**inputs)
^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 461, in diffsynth_controlnet
patch = ZImageControlPatch(model_patch, vae, image, strength, inpaint_image=inpaint_image, mask=mask)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 326, in __init__
self.encoded_image = self.encode_latent_cond(self.image, self.inpaint_image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 356, in encode_latent_cond
return torch.cat([latent_image, mask_, inpaint_image_latent], dim=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Expected all tensors to be on the same device, but got tensors is on cpu, different from other tensors on cuda:0 (when checking argument in method wrapper_CUDA_cat)
2025-12-19T11:33:29.492034 - Prompt executed in 0.22 seconds
2025-12-19T11:33:30.078027 - # PS: PS not connected2025-12-19T11:33:30.078075 -
2025-12-19T11:33:30.127327 - # PS: PS not connected2025-12-19T11:33:30.127365 -
2025-12-19T11:34:26.031594 - sys.platform='linux', git_executable='git'
2025-12-19T11:34:26.032484 - Popen(['git', 'describe', '--tags'], cwd=/ComfyUI, stdin=None, shell=False, universal_newlines=False)
2025-12-19T11:35:14.009249 - got prompt
2025-12-19T11:35:14.011588 - Using selector: EpollSelector
2025-12-19T11:35:14.063148 - # PS: PS not connected2025-12-19T11:35:14.063834 -
2025-12-19T11:35:14.313283 - !!! Exception during processing !!! Expected all tensors to be on the same device, but got tensors is on cpu, different from other tensors on cuda:0 (when checking argument in method wrapper_CUDA_cat)
2025-12-19T11:35:14.314104 - Traceback (most recent call last):
File "/ComfyUI/execution.py", line 516, in execute
output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/execution.py", line 330, in get_output_data
return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/execution.py", line 304, in _async_map_node_over_list
await process_inputs(input_dict, i)
File "/ComfyUI/execution.py", line 292, in process_inputs
result = f(**inputs)
^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 461, in diffsynth_controlnet
patch = ZImageControlPatch(model_patch, vae, image, strength, inpaint_image=inpaint_image, mask=mask)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 326, in __init__
self.encoded_image = self.encode_latent_cond(self.image, self.inpaint_image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 356, in encode_latent_cond
return torch.cat([latent_image, mask_, inpaint_image_latent], dim=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Expected all tensors to be on the same device, but got tensors is on cpu, different from other tensors on cuda:0 (when checking argument in method wrapper_CUDA_cat)
2025-12-19T11:35:14.315253 - Prompt executed in 0.30 seconds
2025-12-19T11:35:15.259555 - # PS: PS not connected2025-12-19T11:35:15.259596 -
2025-12-19T11:35:15.303646 - # PS: PS not connected2025-12-19T11:35:15.303681 -
2025-12-19T11:35:35.064465 - got prompt
2025-12-19T11:35:35.066673 - Using selector: EpollSelector
2025-12-19T11:35:35.191334 - # PS: PS not connected2025-12-19T11:35:35.191387 -
2025-12-19T11:35:35.423739 - !!! Exception during processing !!! Expected all tensors to be on the same device, but got tensors is on cpu, different from other tensors on cuda:0 (when checking argument in method wrapper_CUDA_cat)
2025-12-19T11:35:35.424454 - Traceback (most recent call last):
File "/ComfyUI/execution.py", line 516, in execute
output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/execution.py", line 330, in get_output_data
return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/execution.py", line 304, in _async_map_node_over_list
await process_inputs(input_dict, i)
File "/ComfyUI/execution.py", line 292, in process_inputs
result = f(**inputs)
^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 461, in diffsynth_controlnet
patch = ZImageControlPatch(model_patch, vae, image, strength, inpaint_image=inpaint_image, mask=mask)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 326, in __init__
self.encoded_image = self.encode_latent_cond(self.image, self.inpaint_image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 356, in encode_latent_cond
return torch.cat([latent_image, mask_, inpaint_image_latent], dim=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Expected all tensors to be on the same device, but got tensors is on cpu, different from other tensors on cuda:0 (when checking argument in method wrapper_CUDA_cat)
2025-12-19T11:35:35.425499 - Prompt executed in 0.36 seconds
2025-12-19T11:35:36.002125 - # PS: PS not connected2025-12-19T11:35:36.002163 -
2025-12-19T11:35:36.002194 - # PS: PS not connected2025-12-19T11:35:36.002208 -
2025-12-19T11:40:15.364682 - got prompt
2025-12-19T11:40:15.366926 - Using selector: EpollSelector
2025-12-19T11:40:15.499466 - # PS: PS not connected2025-12-19T11:40:15.499505 -
2025-12-19T11:40:15.666961 - !!! Exception during processing !!! Expected all tensors to be on the same device, but got tensors is on cpu, different from other tensors on cuda:0 (when checking argument in method wrapper_CUDA_cat)
2025-12-19T11:40:15.667795 - Traceback (most recent call last):
File "/ComfyUI/execution.py", line 516, in execute
output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/execution.py", line 330, in get_output_data
return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/execution.py", line 304, in _async_map_node_over_list
await process_inputs(input_dict, i)
File "/ComfyUI/execution.py", line 292, in process_inputs
result = f(**inputs)
^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 461, in diffsynth_controlnet
patch = ZImageControlPatch(model_patch, vae, image, strength, inpaint_image=inpaint_image, mask=mask)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 326, in __init__
self.encoded_image = self.encode_latent_cond(self.image, self.inpaint_image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/ComfyUI/comfy_extras/nodes_model_patch.py", line 356, in encode_latent_cond
return torch.cat([latent_image, mask_, inpaint_image_latent], dim=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Expected all tensors to be on the same device, but got tensors is on cpu, different from other tensors on cuda:0 (when checking argument in method wrapper_CUDA_cat)
2025-12-19T11:40:15.668997 - Prompt executed in 0.30 seconds
```
### Other
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.