From 8c336fed790bffa6805357ad3f439fac7a3c1e6a Mon Sep 17 00:00:00 2001
From: Akshay Shinde <46622301+shindeakshay0211@users.noreply.github.com>
Date: 星期六, 12 四月 2025 00:20:17 +0800
Subject: [PATCH] docs: add MIT license file (#2472) (#2476)

---
 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