From 1c73887d00e33c1f8d4e796a85041b34b1b02359 Mon Sep 17 00:00:00 2001 From: Onur Yuruten Date: Sat, 27 Dec 2025 16:55:55 +0100 Subject: [PATCH 1/3] 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 253413e064a0456cea3bc2e0a3732970f3884fe4 Mon Sep 17 00:00:00 2001 From: Onur Yuruten Date: Sat, 27 Dec 2025 17:24:32 +0100 Subject: [PATCH 2/3] Move 'torchcodec' to optional dependencies --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 186d3ca27..8c289bfce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,6 @@ dependencies = [ "tomli", "torch>=2.0.0", "torchaudio>=2.0.0", - "torchcodec", "torchdiffeq", "tqdm>=4.65.0", "transformers", @@ -46,6 +45,10 @@ dependencies = [ ] [project.optional-dependencies] +video = [ + "torchcodec", +] + eval = [ "faster_whisper==0.10.1", "funasr", From b0ac911f47fd36aa276f912d3e1498abcfe57a59 Mon Sep 17 00:00:00 2001 From: Onur Yuruten Date: Sat, 27 Dec 2025 17:28:18 +0100 Subject: [PATCH 3/3] Removes a commit irrelevant to the The corresponding change is already done for PR 1243 --- 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..a1f311113 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 hasattr(torch, 'xpu') and torch.xpu.is_available() + if torch.xpu.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"