#16365·ComfyUI

YuE2 text encoder falls back to CPU on GTX 1650, causing "Expected a cuda device, but got: cpu"

Author: MPMortazaviCreated Sep 16, 2026Updated Sep 17, 2026

YuE2 text encoder falls back to CPU on GTX 1650, causing Expected a cuda device, but got: cpu

Environment

  • ComfyUI commit: 7a0b5eede3f9721c8faab290689893f36edc6d66
  • Commit: Aimdo 0.5.5 + Auto-detect and enable --fast-disk when the disk is fast (CORE-440) (#16333)
  • Branch: master
  • OS: Parch Linux (Arch-based)
  • Kernel: 7.2.4-arch1-2
  • GPU: NVIDIA GeForce GTX 1650 4GB
  • Compute Capability: 7.5
  • NVIDIA driver: 615.71.09
  • CUDA UMD: 13.4
  • Python: 3.11.14
  • PyTorch: 2.14.0+cu130
  • PyTorch CUDA: 13.0
  • comfy-aimdo: 0.5.5
  • comfy-kitchen: 0.2.34

Model

Using the official ComfyUI YuE2 model:

yue2_3b_int8_convrot.safetensors

The model loads successfully, but YuE2 generation fails when the text encoder is used.

Error

The node:

YuE2GenerateABC

fails with:

ValueError: Expected a cuda device, but got: cpu

The relevant call path is:

YuE2GenerateABC
 -> clip.generate()
 -> comfy/sd.py
 -> comfy.ops.use_quantized_matmul()
 -> get_disabled_quant_formats()
 -> supports_nvfp4_compute()
 -> torch.cuda.get_device_properties(device)
 -> ValueError: Expected a cuda device, but got: cpu

At model loading time ComfyUI reports:

CLIP/text encoder model load device: cpu, offload device: cpu, current: cpu, dtype: torch.float16

Relevant runtime checks

PyTorch correctly detects the GPU:

torch: 2.14.0+cu130
cuda: 13.0
cuda available: True
device: NVIDIA GeForce GTX 1650
capability: (7, 5)

ComfyUI also detects CUDA:

device: cuda:0
vram_state: VRAMState.NORMAL_VRAM
gpu_only: False

However:

text_encoder_device(): cpu
text_encoder_offload_device(): cpu
text_encoder_dtype(cuda): torch.float16

should_use_fp16(cuda, prioritize=False): False
should_use_fp16(cuda, prioritize=True): False

supports_cast(cuda, fp16): True
supports_cast(cuda, fp32): True

supports_int8_compute(cuda): True
supports_fp8_compute(cuda): False
supports_nvfp4_compute(cuda): False

The relevant text_encoder_device() logic is:

def text_encoder_device():
    if args.gpu_only:
        return get_torch_device()
    elif vram_state in (VRAMState.HIGH_VRAM, VRAMState.NORMAL_VRAM) or comfy.memory_management.aimdo_enabled:
        if should_use_fp16(prioritize_performance=False):
            return get_torch_device()
        else:
            return torch.device("cpu")
    else:
        return torch.device("cpu")

Therefore, on this GPU, the text encoder is explicitly selected for CPU because:

should_use_fp16(cuda, prioritize_performance=False) == False

supports_cast(cuda, torch.float16) itself returns True.

Workarounds tested

Running with:

--disable-dynamic-vram

does not change the behavior. The YuE2 text encoder is still loaded with:

load device: cpu
offload device: cpu
current: cpu

Running with:

--gpu-only

causes an out-of-memory condition on the 4GB GTX 1650, so it is not a practical workaround.

Expected behavior

YuE2 should either:

  1. run the text encoder on CUDA when the hardware supports the required FP16/INT8 operations, or
  2. gracefully handle the CPU execution path instead of reaching CUDA-only code with a CPU device.

Actual behavior

The text encoder is placed on CPU, but the YuE2 generation path subsequently assumes a CUDA device and calls CUDA-specific capability checks with device=cpu, resulting in:

ValueError: Expected a cuda device, but got: cpu

This may be related to the text-encoder device selection / FP16 capability logic on Turing GPUs (compute capability 7.5), rather than an inability of PyTorch or CUDA to access the GPU.

A similar class of issue exists in #15607, although the failure path here is different.

Additional information

The GPU itself is functioning correctly and is detected by both PyTorch and ComfyUI. INT8 compute support is also reported as available:

supports_int8_compute(cuda): True

The issue appears specifically when the YuE2 text encoder is assigned to CPU.