How to Configure Voicebox for the Intel XPU GPU Backend
Voicebox automatically detects and utilizes Intel XPU GPUs when the Intel Extension for PyTorch (IPEX) is installed, requiring no manual configuration beyond ensuring the extension is available to the Python environment.
The jamiepine/voicebox repository implements seamless Intel XPU support through automatic device discovery in its PyTorch backend, enabling high-performance text-to-speech generation on Intel Arc and Data Center GPU Flex Series hardware. When the Intel oneAPI Deep Learning Toolkit components are present, Voicebox prioritizes the XPU device during model initialization and runtime execution.
How Voicebox Automatically Detects XPU GPUs
Voicebox determines the compute device through a cascading detection pipeline defined in backend/utils/platform_detect.py and backend/backends/base.py.
First, backend/utils/platform_detect.py (lines 19-35) selects the backend type. On non-Apple Silicon platforms, it returns "pytorch", which activates the PyTorch device selection logic.
Next, backend/backends/base.py (lines 80-108) implements the get_torch_device() function. When called with allow_xpu=True, the function executes the following priority chain:
- Check for NVIDIA CUDA availability
- If
allow_xpuis enabled, importintel_extension_for_pytorchand verifytorch.xpu.is_available() - Fall back to DirectML, MPS (Apple Silicon), or CPU
When torch.xpu.is_available() returns True, the function returns the string "xpu", which propagates throughout the backend systems.
Prerequisites: Installing Intel Extension for PyTorch
For XPU detection to succeed, you must install the Intel Extension for PyTorch (IPEX) that matches your PyTorch version. This extension registers the torch.xpu module that Voicebox interrogates during startup.
Install the matching versions using pip:
# Example for PyTorch 2.3 – adjust versions to match Voicebox requirements
pip install torch==2.3.0 intel-extension-for-pytorch==2.3.0
IPEX exposes the torch.xpu namespace, enabling torch.xpu.is_available() to return True when Intel XPU hardware is present and drivers are correctly installed.
Verifying XPU Detection Programmatically
You can confirm that Voicebox will select the XPU device by calling the same helper function used internally during model loading:
from voicebox.backend.backends.base import get_torch_device
# Allow XPU and DirectML as fallbacks
device = get_torch_device(allow_xpu=True, allow_directml=True)
print(f"Voicebox will run on: {device}")
Expected output on a machine with XPU support:
xpu
If IPEX is not installed or no XPU is present, the function silently catches the ImportError and returns the next available device (CUDA, DirectML, MPS, or CPU).
Runtime Device Propagation and Model Loading
Once detected, the "xpu" device string flows through the backend architecture. In backend/backends/pytorch_backend.py (lines 36-40), the concrete backend class initializes self.device by calling get_torch_device(allow_xpu=True, ...).
This device value is then passed to model loading functions via the device_map=self.device parameter. When load_model_async() executes, it places the TTS model directly on the XPU. During generation, all tensor operations execute on the XPU device, with memory management routines in backend/backends/base.py (lines 140-157) handling torch.xpu.empty_device_cache() and torch.xpu.manual_seed() calls.
Monitoring XPU Status via the Health Endpoint
The /health endpoint defined in backend/routes/health.py (lines 68-78) exposes XPU runtime status. When XPU is active, the endpoint interrogates torch.xpu to retrieve the GPU name via torch.xpu.get_device_name(0) and reports XPU-specific VRAM statistics.
Example JSON response when XPU is present:
{
"version": "v1.5.2",
"backend": "PYTORCH",
"gpu_available": true,
"gpu_type": "XPU (Intel Arc A770)",
"vram_used_mb": 1024,
"model_loaded": true,
"model_size": "1.7B"
}
Summary
- Automatic detection: Voicebox detects XPU via
get_torch_device(allow_xpu=True)inbackend/backends/base.pywithout configuration files. - IPEX requirement: Install
intel-extension-for-pytorchmatching your PyTorch version to enabletorch.xpusupport. - Device propagation: The
"xpu"string flows from base detection throughpytorch_backend.pyto model loading viadevice_map. - Health monitoring: The
/healthendpoint reports XPU device names and VRAM usage when active. - Graceful fallback: If IPEX is missing, Voicebox automatically selects CUDA, DirectML, MPS, or CPU.
Frequently Asked Questions
Do I need to manually edit configuration files to enable XPU support?
No. Voicebox does not require manual configuration flags or JSON edits to utilize XPU hardware. Simply install the Intel Extension for PyTorch before starting the server. The get_torch_device() function in backend/backends/base.py automatically detects XPU availability when allow_xpu=True is passed during backend initialization.
What happens if I install Voicebox but forget to install IPEX?
If intel_extension_for_pytorch is not importable, Voicebox catches the ImportError in backend/backends/base.py and skips the XPU detection branch. The system falls back through the device priority chain: NVIDIA CUDA, DirectML, Apple MPS, or CPU. No errors are thrown; the server simply operates on the next available compute device.
Which Intel GPUs are compatible with Voicebox?
Voicebox supports any Intel GPU compatible with the Intel Extension for PyTorch, including Intel Arc A-Series graphics (A770, A750) and Intel Data Center GPU Flex Series. The specific hardware name is retrieved at runtime via torch.xpu.get_device_name(0) and reported in the health endpoint JSON payload.
How can I verify that my generation request is actually running on XPU?
Check the /health endpoint response for "gpu_type": "XPU (...)" or monitor the server logs during model loading. You can also programmatically verify the device selection by importing from voicebox.backend.backends.base import get_torch_device and printing the result before initializing the TTSService. When XPU is active, torch.xpu memory management functions handle cache clearing between generations.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →