Add support for Intel GPUs (#298)

This commit is contained in:
仙舟龙脉研究所 2025-09-09 20:31:50 +08:00 committed by GitHub
parent 055a23a12b
commit 5d6a18a776
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -45,6 +45,10 @@ class IndexTTS:
self.device = "cuda:0"
self.use_fp16 = use_fp16
self.use_cuda_kernel = use_cuda_kernel is None or use_cuda_kernel
elif hasattr(torch, "xpu") and torch.xpu.is_available():
self.device = "xpu"
self.use_fp16 = use_fp16
self.use_cuda_kernel = False
elif hasattr(torch, "mps") and torch.backends.mps.is_available():
self.device = "mps"
self.use_fp16 = False # Use float16 on MPS is overhead than float32

View File

@ -56,6 +56,10 @@ class IndexTTS2:
self.device = "cuda:0"
self.use_fp16 = use_fp16
self.use_cuda_kernel = use_cuda_kernel is None or use_cuda_kernel
elif hasattr(torch, "xpu") and torch.xpu.is_available():
self.device = "xpu"
self.use_fp16 = use_fp16
self.use_cuda_kernel = False
elif hasattr(torch, "mps") and torch.backends.mps.is_available():
self.device = "mps"
self.use_fp16 = False # Use float16 on MPS is overhead than float32