From d43d0853dcf3a1db04302c7b527e92ace3ccfb55 Mon Sep 17 00:00:00 2001
From: AldarisX <aldaris@axnet.icu>
Date: 星期一, 07 四月 2025 21:20:31 +0800
Subject: [PATCH] add intel xpu support (#2468)
---
funasr/auto/auto_model.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/funasr/auto/auto_model.py b/funasr/auto/auto_model.py
index 96c642e..d274fb9 100644
--- a/funasr/auto/auto_model.py
+++ b/funasr/auto/auto_model.py
@@ -182,7 +182,9 @@
set_all_random_seed(kwargs.get("seed", 0))
device = kwargs.get("device", "cuda")
- if not torch.cuda.is_available() or kwargs.get("ngpu", 1) == 0:
+ if ((device =="cuda" and not torch.cuda.is_available())
+ or (device == "xpu" and not torch.xpu.is_available())
+ or kwargs.get("ngpu", 1) == 0):
device = "cpu"
kwargs["batch_size"] = 1
kwargs["device"] = device
--
Gitblit v1.9.1