FunASR/runtime/onnxruntime
nianjiuhuiyi 05c8eba11c
Fix: 修复c++后端服务因为空数组的异常退出,以及c++的http服务在收到Ctrl+C信号后无法正常退出 (#2571)
* Fix: 修复c++后端,在持续接收请求过程中运行不定时长后,服务会因为segmentation fault挂掉

添加msg_stamp是否为空的判断,在某些特定请求中,msg_stamp可能为空,避免msg_stamp为空时,直接对其进行取值操作。

* Fix: 修复c++的http服务在收到Ctrl+C信号后无法正常退出的问题

在程序主动退出时,添加工作守卫的移除,确保在捕获Ctrl+C信号后,程序能正退退出。
2025-06-27 09:57:45 +08:00
..
bin Merge Dev tclas (#1847) 2024-06-25 17:38:04 +08:00
include support SenseVoiceSmall in 2pass mode 2024-10-29 11:40:18 +08:00
src Fix: 修复c++后端服务因为空数组的异常退出,以及c++的http服务在收到Ctrl+C信号后无法正常退出 (#2571) 2025-06-27 09:57:45 +08:00
third_party Merge branch 'dev_batch' into main 2024-05-27 15:46:26 +08:00
CMakeLists.txt Merge branch 'dev_batch' into main 2024-05-27 15:46:26 +08:00
CMakeSettings.json Dev new (#1065) 2023-11-07 18:34:29 +08:00
readme.md Update readme.md 2023-12-18 09:39:47 +08:00

Please ref to websocket service

If you want to compile the file yourself, you can follow the steps below.

Building for Linux/Unix

Download onnxruntime

wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/onnxruntime-linux-x64-1.14.0.tgz
tar -zxvf onnxruntime-linux-x64-1.14.0.tgz

Download ffmpeg

wget https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/ffmpeg-master-latest-linux64-gpl-shared.tar.xz
tar -xvf ffmpeg-master-latest-linux64-gpl-shared.tar.xz

Install deps

# openblas
sudo apt-get install libopenblas-dev #ubuntu
# sudo yum -y install openblas-devel #centos

# openssl
apt-get install libssl-dev #ubuntu 
# yum install openssl-devel #centos

Build runtime

git clone https://github.com/alibaba-damo-academy/FunASR.git && cd FunASR/runtime/onnxruntime
mkdir build && cd build
cmake  -DCMAKE_BUILD_TYPE=release .. -DONNXRUNTIME_DIR=/path/to/onnxruntime-linux-x64-1.14.0 -DFFMPEG_DIR=/path/to/ffmpeg-master-latest-linux64-gpl-shared
make -j 4

Building for Windows

Download onnxruntime

https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/onnxruntime-win-x64-1.16.1.zip

Download and unzip to d:/onnxruntime-win-x64-1.16.1

Download ffmpeg

https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/dep_libs/ffmpeg-master-latest-win64-gpl-shared.zip

Download and unzip to d:/ffmpeg-master-latest-win64-gpl-shared

Build runtime

git clone https://github.com/alibaba-damo-academy/FunASR.git
cd FunASR/runtime/onnxruntime
mkdir build
cd build
cmake ../ -D FFMPEG_DIR=d:/ffmpeg-master-latest-win64-gpl-shared -D ONNXRUNTIME_DIR=d:/onnxruntime-win-x64-1.16.1

Visual Studio open FunASR/runtime/onnxruntime/build/FunASROnnx.sln start build. After compilation, the executable file is located here: FunASR/runtime/onnxruntime/build/bin/Debug. Copy the required DLL libraries from (onnxruntime-win-x64-1.16.1/lib, ffmpeg-master-latest-win64-gpl-shared/bin) to this location: FunASR/runtime/onnxruntime/build/bin/Debug