From 05c8eba11c51ca928eee9c041de1a4192e590aec Mon Sep 17 00:00:00 2001
From: nianjiuhuiyi <64776403+nianjiuhuiyi@users.noreply.github.com>
Date: 星期五, 27 六月 2025 09:57:45 +0800
Subject: [PATCH] Fix: 修复c++后端服务因为空数组的异常退出,以及c++的http服务在收到Ctrl+C信号后无法正常退出 (#2571)
---
funasr/utils/export_utils.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/funasr/utils/export_utils.py b/funasr/utils/export_utils.py
index c89dd77..b03b052 100644
--- a/funasr/utils/export_utils.py
+++ b/funasr/utils/export_utils.py
@@ -28,12 +28,12 @@
**kwargs,
)
elif type == "torchscript":
- device = "cuda" if torch.cuda.is_available() else "xpu" if torch.xpu.is_available() else "cpu"
+ device = "cuda" if torch.cuda.is_available() else "xpu" if torch.xpu.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
print("Exporting torchscripts on device {}".format(device))
_torchscripts(m, path=export_dir, device=device)
elif type == "bladedisc":
assert (
- torch.cuda.is_available() or torch.xpu.is_available()
+ torch.cuda.is_available() or torch.xpu.is_available() or torch.backends.mps.is_available()
), "Currently bladedisc optimization for FunASR only supports GPU"
# bladedisc only optimizes encoder/decoder modules
if hasattr(m, "encoder") and hasattr(m, "decoder"):
@@ -44,7 +44,7 @@
elif type == "onnx_fp16":
assert (
- torch.cuda.is_available() or torch.xpu.is_available()
+ torch.cuda.is_available() or torch.xpu.is_available() or torch.backends.mps.is_available()
), "Currently onnx_fp16 optimization for FunASR only supports GPU"
if hasattr(m, "encoder") and hasattr(m, "decoder"):
--
Gitblit v1.9.1