invoke-ai/InvokeAI · error · ValueError
generation_devices requested '{device_str}', but no XPU devi
Error message
generation_devices requested '{device_str}', but no XPU device is available. What it means
get_generation_devices validates XPU devices analogously to CUDA: an explicitly requested xpu device is rejected immediately if Intel XPU support is not available (_xpu_is_available() is false — no torch.xpu device / IPEX runtime).
Source
Thrown at invokeai/backend/util/devices.py:305
devices: list[torch.device] = []
seen: set[str] = set()
for device_str in device_strs:
device = cls.normalize(device_str)
# Fail fast on a CUDA device that doesn't exist, rather than starting a worker pinned to
# it that only errors cryptically at the first tensor allocation. ("auto" only generates
# valid indices, so this just validates explicitly-configured devices.)
if device.type == "cuda":
if not torch.cuda.is_available():
raise ValueError(f"generation_devices requested '{device_str}', but no CUDA device is available.")
if device.index is not None and device.index >= torch.cuda.device_count():
raise ValueError(
f"generation_devices requested '{device_str}', but only {torch.cuda.device_count()} "
f"CUDA device(s) are available (valid indices 0-{torch.cuda.device_count() - 1})."
)
elif device.type == "xpu":
if not _xpu_is_available():
raise ValueError(f"generation_devices requested '{device_str}', but no XPU device is available.")
if device.index is not None and device.index >= torch.xpu.device_count():
raise ValueError(
f"generation_devices requested '{device_str}', but only {torch.xpu.device_count()} "
f"XPU device(s) are available (valid indices 0-{torch.xpu.device_count() - 1})."
)
elif device.type == "mps" and not torch.backends.mps.is_available():
raise ValueError(f"generation_devices requested '{device_str}', but MPS is not available.")
if str(device) not in seen:
seen.add(str(device))
devices.append(device)
return devices
@classmethod
def normalize(cls, device: Union[str, torch.device]) -> torch.device:
"""Add the device index to CUDA and XPU devices."""
device = torch.device(device)
if device.index is None and device.type == "cuda" and torch.cuda.is_available():
device = torch.device(device.type, torch.cuda.current_device())View on GitHub (pinned to 0b6a024f2f)
Solutions
- Switch generation_devices to 'auto', 'cpu', or 'cuda' as appropriate for the host
- Install XPU-capable torch/IPEX and Intel GPU drivers if XPU is intended
- Verify with torch.xpu.is_available() (or the codebase's _xpu_is_available) before pinning xpu
Example fix
// before generation_devices: ["xpu:0"] # host without Intel GPU // after generation_devices: ["auto"]
Defensive patterns
Strategy: validation
Validate before calling
import torch
def xpu_available() -> bool:
try:
return bool(torch.xpu.device_count())
except Exception:
return False
if any(str(d).startswith("xpu") for d in generation_devices) and not xpu_available():
generation_devices = ["auto"] Type guard
def is_xpu_config_valid(devices: list[str]) -> bool:
try:
has_xpu = bool(torch.xpu.device_count())
except Exception:
has_xpu = False
return all(not d.startswith("xpu") for d in devices) or has_xpu Try / catch
try:
devices = DeviceService.get_generation_devices(cfg.generation_devices)
except ValueError as e:
if "no XPU device is available" in str(e):
log.warning("XPU unavailable; falling back to auto")
devices = DeviceService.get_generation_devices(["auto"])
else:
raise Prevention
- Verify Intel GPU drivers and XPU-capable torch/IPEX before configuring xpu devices
- Test with torch.xpu.device_count() at startup
- Use 'auto' on non-Intel hosts
- Keep per-host device configs instead of sharing pinned xpu settings
When it happens
Trigger: Configuring generation_devices 'xpu:*' on hosts without Intel GPU support: no Intel GPU/driver, torch build without XPU support, or IPEX not installed/initialized.
Common situations: Reusing a config from an Intel-GPU machine on an NVIDIA or CPU host; missing intel drivers; XPU-enabled torch wheel not installed.
Related errors
- generation_devices requested '{device_str}', but no CUDA dev
- generation_devices requested '{device_str}', but only {torch
- str(e)
- Multiuser mode is disabled. Authentication is not required i
- Multiuser mode is disabled. Admin setup is not required in s
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/73a7e9dbab6e3263.
Report an issue: GitHub.