OpenBMB/VoxCPM · error · ValueError

Unsupported device '{device}'. Supported values are 'auto',

Error message

Unsupported device '{device}'. Supported values are 'auto', 'cpu', 'mps', 'cuda', or indexed CUDA devices like 'cuda:0'.

What it means

The final else of resolve_runtime_device: any device string that is not 'auto', 'cpu', 'mps', 'cuda', or 'cuda:<index>' raises ValueError listing the supported forms.

Source

Thrown at src/voxcpm/model/utils.py:239

    if explicit is None or explicit == "auto":
        return auto_select_device(configured_device)

    if explicit.startswith("cuda"):
        if not torch.cuda.is_available():
            raise ValueError(
                f"Requested device '{device}', but CUDA is not available. " "Use device='auto' for automatic fallback."
            )
        return explicit
    if explicit == "mps":
        if not _has_mps():
            raise ValueError(
                "Requested device 'mps', but MPS is not available. " "Use device='auto' for automatic fallback."
            )
        return "mps"
    if explicit == "cpu":
        return "cpu"

    raise ValueError(
        f"Unsupported device '{device}'. Supported values are 'auto', 'cpu', 'mps', "
        "'cuda', or indexed CUDA devices like 'cuda:0'."
    )

View on GitHub (pinned to f5a1c6a6b9)

Solutions

  1. Use exactly 'auto','cpu','mps','cuda', or 'cuda:0'-style strings, lowercase
  2. Strip/normalize config-provided device strings before passing them
  3. Validate device values against the supported set at config load time

Example fix

# before
model = VoxCPM(..., device="GPU")
# after
model = VoxCPM(..., device="auto")
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {"auto", "cpu", "mps", "cuda"}
d = device.strip().lower()
if d not in SUPPORTED and not (d.startswith("cuda:") and d[5:].isdigit()):
    d = "auto"

Type guard

def is_valid_device(s: str) -> bool:
    s = s.strip().lower()
    return s in {"auto","cpu","mps","cuda"} or (s.startswith("cuda:") and s[5:].isdigit())

Prevention

When it happens

Trigger: Passing device='gpu', 'CUDA', 'cuda-0', 'metal', or 'cuda:' (empty index).

Common situations: Porting code from other frameworks with different device naming (e.g. 'gpu'), or trailing whitespace/case typos in config files.

Related errors


AI-assisted analysis of OpenBMB/VoxCPM@f5a1c6a6b9 (2026-08-27). Data as JSON: /api/errors/76077e7bf5767234. Report an issue: GitHub.