Device / GPU

Tensors on different devices (cuda vs cpu)

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

An operation received tensors split across the GPU and CPU. Something in the graph forced part of the work onto a different device than the rest.

What it means

PyTorch operations require their inputs to live on the same device. This error means one tensor is on the GPU (cuda:0) and another is on the CPU when they meet in a single operation. ComfyUI normally keeps everything consistent, so a mismatch usually comes from a node or flag that pins part of the pipeline to a specific device.

It is a placement problem, not a model or memory problem: the goal is to get every participating tensor onto the same device.

Common causes

  • A custom node forces its computation onto CPU while the rest runs on GPU.
  • A device flag (e.g. forcing CPU for one component) mixed with GPU execution.
  • A model was offloaded to CPU mid-graph and then used by a GPU node.
  • A bug in a custom node that does not move its tensors to the active device.

How to fix it

  1. 1

    Remove forced-device settings

    Undo any per-node "run on CPU" option or launch flag that pins one component to a different device than the rest of the graph.

  2. 2

    Update the custom node involved

    If a specific custom node triggers it, update that node — device-placement bugs are commonly fixed upstream.

  3. 3

    Keep the pipeline on one device

    Run the whole workflow on the GPU (or the whole thing on CPU) rather than mixing; avoid combining --cpu with GPU-only nodes.

  4. 4

    Restart after changing device flags

    Device assignment is set at load; restart ComfyUI after changing any device-related launch flag.

Frequently asked questions

Frequently Asked Questions

Quick answers to the most common questions.

Related errors

Make every ComfyUI run reproducible

Numonic captures the full workflow behind each ComfyUI generation — models, samplers, seeds, prompts, and custom nodes — so a setup that finally works is one you can find and rebuild, not re-debug.