Skip to content

The open-source AI voice studio. Clone, dictate, create.

fix: complete Intel XPU support — device-aware seeding, GPU status reporting, and setup detection

James Pine707046237c42
diff --git a/backend/app.py b/backend/app.py
index f652d149..1293460a 100644
--- a/backend/app.py
+++ b/backend/app.py
@@ -155,6 +155,20 @@ def _get_gpu_status() -> str:
return "MPS (Apple Silicon)"
elif backend_type == "mlx":
return "Metal (Apple Silicon via MLX)"
+
+ # Intel XPU (Arc / Data Center) via IPEX
+ try:
+ import intel_extension_for_pytorch # noqa: F401
+
+ if hasattr(torch, "xpu") and torch.xpu.is_available():
+ try:
+ xpu_name = torch.xpu.get_device_name(0)
+ except Exception:
+ xpu_name = "Intel GPU"
+ return f"XPU ({xpu_name})"
+ except ImportError:
+ pass
+
return "None (CPU only)"
diff --git a/backend/backends/chatterbox_backend.py b/backend/backends/chatterbox_backend.py
index 9b061bb1..e7a025b3 100644
--- a/backend/backends/chatterbox_backend.py
+++ b/backend/backends/chatterbox_backend.py
@@ -19,6 +19,7 @@ from .base import (
is_model_cached,
get_torch_device,
empty_device_cache,
+ manual_seed,
combine_voice_prompts as _combine_voice_prompts,
model_load_progress,
patch_chatterbox_f32,
@@ -198,7 +199,7 @@ class ChatterboxTTSBackend:
import torch
if seed is not None:
- torch.manual_seed(seed)
+ manual_seed(seed, self._device)
logger.info(f"[Chatterbox] Generating: lang={language}")
diff --git a/backend/backends/chatterbox_turbo_backend.py b/backend/backends/chatterbox_turbo_backend.py
index fcdbf39e..6f7d6b94 100644
--- a/backend/backends/chatterbox_turbo_backend.py
+++ b/backend/backends/chatterbox_turbo_backend.py
@@ -19,6 +19,7 @@ from .base import (
is_model_cached,
get_torch_device,
empty_device_cache,
+ manual_seed,
combine_voice_prompts as _combine_voice_prompts,
model_load_progress,
patch_chatterbox_f32,
@@ -179,7 +180,7 @@ class ChatterboxTurboTTSBackend:
import torch
if seed is not None:
- torch.manual_seed(seed)
+ manual_seed(seed, self._device)
logger.info("[Chatterbox Turbo] Generating (English)")
diff --git a/backend/backends/luxtts_backend.py b/backend/backends/luxtts_backend.py
index 6f88fa3e..7f15686a 100644
--- a/backend/backends/luxtts_backend.py
+++ b/backend/backends/luxtts_backend.py
@@ -16,6 +16,7 @@ from .base import (
is_model_cached,
get_torch_device,
empty_device_cache,
+ manual_seed,
combine_voice_prompts as _combine_voice_prompts,
model_load_progress,
)
@@ -163,12 +164,8 @@ class LuxTTSBackend:
await self.load_model()
def _generate_sync():
- import torch
-
if seed is not None:
- torch.manual_seed(seed)
- if torch.cuda.is_available():
- torch.cuda.manual_seed(seed)
+ manual_seed(seed, self.device)
wav = self.model.generate_speech(
text=text,
diff --git a/backend/routes/health.py b/backend/routes/health.py
index f138e336..66cc9b62 100644
--- a/backend/routes/health.py
+++ b/backend/routes/health.py
@@ -110,6 +110,11 @@ async def health():
vram_used = None
if has_cuda:
vram_used = torch.cuda.memory_allocated() / 1024 / 1024
+ elif has_xpu:
+ try:
+ vram_used = torch.xpu.memory_allocated() / 1024 / 1024
+ except Exception:
+ pass # memory_allocated() may not be available on all IPEX versions
model_loaded = False
model_size = None
@@ -162,7 +167,10 @@ async def health():
gpu_type=gpu_type,
vram_used_mb=vram_used,
backend_type=backend_type,
- backend_variant=os.environ.get("VOICEBOX_BACKEND_VARIANT", "cuda" if torch.cuda.is_available() else "cpu"),
+ backend_variant=os.environ.get(
+ "VOICEBOX_BACKEND_VARIANT",
+ "cuda" if torch.cuda.is_available() else ("xpu" if has_xpu else "cpu"),
+ ),
)
diff --git a/justfile b/justfile
index 1bddbf69..b17243fb 100644
--- a/justfile
+++ b/justfile
@@ -69,8 +69,10 @@ setup-python:
}
Write-Host "Installing Python dependencies..."
& "{{ python }}" -m pip install --upgrade pip -q
- $hasNvidia = $null -ne (Get-WmiObject Win32_VideoController | Where-Object { $_.Name -match 'NVIDIA' })
- $hasIntelArc = $null -ne (Get-WmiObject Win32_VideoController | Where-Object { $_.Name -match 'Intel.*Arc' })
+ $gpus = Get-CimInstance Win32_VideoController | Select-Object -ExpandProperty Name
+ Write-Host "Detected GPUs: $($gpus -join ', ')"
+ $hasNvidia = ($gpus | Where-Object { $_ -match 'NVIDIA' }).Count -gt 0
+ $hasIntelArc = ($gpus | Where-Object { $_ -match 'Arc' }).Count -gt 0
if ($hasNvidia) { \
Write-Host "NVIDIA GPU detected — installing PyTorch with CUDA support..."; \
& "{{ pip }}" install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128; \
@@ -78,6 +80,11 @@ setup-python:
Write-Host "Intel Arc GPU detected — installing PyTorch with XPU support..."; \
& "{{ pip }}" install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/xpu; \
& "{{ pip }}" install intel-extension-for-pytorch --index-url https://download.pytorch.org/whl/xpu; \
+ } else { \
+ Write-Host "No NVIDIA or Intel Arc GPU detected — using CPU-only PyTorch."; \
+ Write-Host "If you have an Intel Arc GPU, install XPU support manually:"; \
+ Write-Host " pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/xpu"; \
+ Write-Host " pip install intel-extension-for-pytorch --index-url https://download.pytorch.org/whl/xpu"; \
}
& "{{ pip }}" install -r {{ backend_dir }}/requirements.txt
& "{{ pip }}" install --no-deps chatterbox-tts