diff --git a/src/f5_tts/infer/utils_infer.py b/src/f5_tts/infer/utils_infer.py index a1f311113..0fc94a0f7 100644 --- a/src/f5_tts/infer/utils_infer.py +++ b/src/f5_tts/infer/utils_infer.py @@ -39,9 +39,9 @@ "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() + if hasattr(torch.backends, "mps") and torch.backends.mps.is_available() else "cpu" )