OpenBMB/VoxCPM · error · ValueError

Requested device 'mps', but MPS is not available. Use device

Error message

Requested device 'mps', but MPS is not available. Use device='auto' for automatic fallback.

What it means

Explicitly requesting device='mps' fails with ValueError when torch.backends.mps is unavailable, mirroring the CUDA check. 'auto' would fall back instead.

Source

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

    Semantics:
    - ``device`` is ``None`` or ``"auto"``: use automatic fallback selection
    - otherwise: treat it as an explicit user choice and validate availability
    """
    explicit = None if device is None else device.strip().lower()

    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 device='auto' so the model falls back to CPU/CUDA as available
  2. On macOS, upgrade to a torch version with MPS support and a supported macOS version
  3. Pass device='cpu' or 'cuda' explicitly on non-Apple machines

Example fix

# before
model = VoxCPM(..., device="mps")  # on Linux
# after
model = VoxCPM(..., device="auto")
Defensive patterns

Strategy: fallback

Validate before calling

import torch
def mps_ok() -> bool:
    return hasattr(torch.backends, "mps") and torch.backends.mps.is_available()
if device == "mps" and not mps_ok():
    device = "auto"

Type guard

def mps_ok() -> bool:
    import torch; return getattr(torch.backends, "mps", None) is not None and torch.backends.mps.is_available()

Prevention

When it happens

Trigger: Passing device='mps' on Linux/Windows, on macOS without Apple Silicon or too-old macOS/torch, or in environments where MPS is disabled.

Common situations: Config written for Apple Silicon reused on a Linux server; older torch builds predating MPS support.

Related errors


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