From 1c73887d00e33c1f8d4e796a85041b34b1b02359 Mon Sep 17 00:00:00 2001 From: Onur Yuruten Date: Sat, 27 Dec 2025 16:55:55 +0100 Subject: [PATCH 1/2] Fix device selection logic for XPU availability Problem: torch.xpu.is_available() can trigger an exception for users running PyTorch 2.0-2.3. Solution: Add hasattr(torch, 'xpu') check before calling torch.xpu.is_available(). This ensures backward compatibility with PyTorch 2.0+ while still supporting Intel XPU acceleration when available. --- src/f5_tts/infer/utils_infer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/f5_tts/infer/utils_infer.py b/src/f5_tts/infer/utils_infer.py index a1f311113..876d521c9 100644 --- a/src/f5_tts/infer/utils_infer.py +++ b/src/f5_tts/infer/utils_infer.py @@ -39,7 +39,7 @@ "cuda" if torch.cuda.is_available() else "xpu" - if torch.xpu.is_available() + if hasattr(torch, 'xpu') and torch.xpu.is_available() else "mps" if torch.backends.mps.is_available() else "cpu" From fd5d5bd302e7992c9944e4221843e490f73adfef Mon Sep 17 00:00:00 2001 From: Onur Yuruten Date: Sun, 28 Dec 2025 15:55:25 +0100 Subject: [PATCH 2/2] Fix check for MPS availability in utils_infer.py --- src/f5_tts/infer/utils_infer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/f5_tts/infer/utils_infer.py b/src/f5_tts/infer/utils_infer.py index 876d521c9..0fc94a0f7 100644 --- a/src/f5_tts/infer/utils_infer.py +++ b/src/f5_tts/infer/utils_infer.py @@ -41,7 +41,7 @@ else "xpu" if hasattr(torch, 'xpu') and torch.xpu.is_available() else "mps" - if torch.backends.mps.is_available() + if hasattr(torch.backends, "mps") and torch.backends.mps.is_available() else "cpu" )