游雁 828b5f81af docs 2 anni fa
..
images 950676275d cpp onnxruntime 3 anni fa
include 1a6242fd4f support arbitrary sampling rate 2 anni fa
src 58c119c508 modify paraformer onnx init 2 anni fa
tester dc8a0445d5 fix bug: msg.c_str 2 anni fa
third_party c525262af6 rm webrtc 3 anni fa
wave 37aec4ec07 update files. 3 anni fa
win 950676275d cpp onnxruntime 3 anni fa
CMakeLists.txt 1a6242fd4f support arbitrary sampling rate 2 anni fa
CMakeSettings.json 39529df088 update files. 3 anni fa
readme.md 828b5f81af docs 2 anni fa

readme.md

ONNXRuntime-cpp

Export the model

Install modelscope and funasr

pip3 install torch torchaudio
pip install -U modelscope
pip install -U funasr

Export onnx model

python -m funasr.export.export_model --model-name damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch --export-dir ./export --type onnx --quantize True

Building for Linux/Unix

Download onnxruntime

# download an appropriate onnxruntime from https://github.com/microsoft/onnxruntime/releases/tag/v1.14.0
# here we get a copy of onnxruntime for linux 64
wget https://github.com/microsoft/onnxruntime/releases/download/v1.14.0/onnxruntime-linux-x64-1.14.0.tgz
tar -zxvf onnxruntime-linux-x64-1.14.0.tgz

Install fftw3

sudo apt install libfftw3-dev #ubuntu
# sudo yum install fftw fftw-devel #centos

Install openblas

sudo apt-get install libopenblas-dev #ubuntu
# sudo yum -y install openblas-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
make

Building for Windows

Ref to win/

Run the demo

tester /path/models_dir /path/wave_file quantize(true or false)

The structure of /path/models_dir

config.yaml, am.mvn, model.onnx(or model_quant.onnx)

Acknowledge

  1. This project is maintained by FunASR community.
  2. We acknowledge mayong for contributing the onnxruntime(cpp api).
  3. We borrowed a lot of code from FastASR for audio frontend and text-postprocess.