Support onnxruntime 1.18.0 (#906)

This commit is contained in:
Fangjun Kuang
2024-07-10 17:05:26 +08:00
committed by GitHub
parent 9e446b8501
commit dd0ff2ca06
107 changed files with 644 additions and 601 deletions

View File

@@ -121,9 +121,9 @@ rm sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k.tar.bz2
node ./test_asr_non_streaming_nemo_ctc.js
rm -rf sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
tar xvf sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
rm sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
tar xvf sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
rm sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
node ./test_asr_non_streaming_paraformer.js
@@ -134,7 +134,7 @@ curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/i
node ./test_asr_non_streaming_paraformer_itn.js
rm -rf sherpa-onnx-paraformer-zh-2023-03-28
rm -rf sherpa-onnx-paraformer-zh-2023-09-14
echo "----------tts----------"

View File

@@ -11,16 +11,16 @@ ls -lh node_modules
# offline asr
curl -LS -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
curl -LS -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
ls -lh
tar xvf sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
rm sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
tar xvf sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
rm sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
rm -f itn*
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn-zh-number.wav
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn_zh_number.fst
node ./test-offline-paraformer-itn.js
rm -rf sherpa-onnx-paraformer-zh-2023-03-28
rm -rf sherpa-onnx-paraformer-zh-2023-09-14
curl -LS -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-nemo-ctc-en-conformer-small.tar.bz2
ls -lh
@@ -29,12 +29,12 @@ rm sherpa-onnx-nemo-ctc-en-conformer-small.tar.bz2
node ./test-offline-nemo-ctc.js
rm -rf sherpa-onnx-nemo-ctc-en-conformer-small
curl -LS -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
curl -LS -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
ls -lh
tar xvf sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
rm sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
tar xvf sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
rm sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
node ./test-offline-paraformer.js
rm -rf sherpa-onnx-paraformer-zh-2023-03-28
rm -rf sherpa-onnx-paraformer-zh-2023-09-14
curl -LS -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-en-2023-06-26.tar.bz2
ls -lh

View File

@@ -15,6 +15,49 @@ echo "PATH: $PATH"
which $EXE
if false; then
# It has problems with onnxruntime 1.18
log "------------------------------------------------------------"
log "Run Wenet models"
log "------------------------------------------------------------"
wenet_models=(
sherpa-onnx-zh-wenet-aishell
# sherpa-onnx-zh-wenet-aishell2
# sherpa-onnx-zh-wenet-wenetspeech
# sherpa-onnx-zh-wenet-multi-cn
sherpa-onnx-en-wenet-librispeech
# sherpa-onnx-en-wenet-gigaspeech
)
for name in ${wenet_models[@]}; do
repo_url=https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/$name.tar.bz2
log "Start testing ${repo_url}"
repo=$name
log "Download pretrained model and test-data from $repo_url"
curl -SL -O $repo_url
tar xvf $name.tar.bz2
rm $name.tar.bz2
log "test float32 models"
time $EXE \
--tokens=$repo/tokens.txt \
--wenet-ctc-model=$repo/model.onnx \
$repo/test_wavs/0.wav \
$repo/test_wavs/1.wav \
$repo/test_wavs/8k.wav
log "test int8 models"
time $EXE \
--tokens=$repo/tokens.txt \
--wenet-ctc-model=$repo/model.int8.onnx \
$repo/test_wavs/0.wav \
$repo/test_wavs/1.wav \
$repo/test_wavs/8k.wav
rm -rf $repo
done
fi
log "test offline TeleSpeech CTC"
url=https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-telespeech-ctc-int8-zh-2024-06-04.tar.bz2
name=$(basename $url)
@@ -145,44 +188,7 @@ done
rm -rf $repo
log "------------------------------------------------------------"
log "Run Wenet models"
log "------------------------------------------------------------"
wenet_models=(
sherpa-onnx-zh-wenet-aishell
# sherpa-onnx-zh-wenet-aishell2
# sherpa-onnx-zh-wenet-wenetspeech
# sherpa-onnx-zh-wenet-multi-cn
sherpa-onnx-en-wenet-librispeech
# sherpa-onnx-en-wenet-gigaspeech
)
for name in ${wenet_models[@]}; do
repo_url=https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/$name.tar.bz2
log "Start testing ${repo_url}"
repo=$name
log "Download pretrained model and test-data from $repo_url"
curl -SL -O $repo_url
tar xvf $name.tar.bz2
rm $name.tar.bz2
log "test float32 models"
time $EXE \
--tokens=$repo/tokens.txt \
--wenet-ctc-model=$repo/model.onnx \
$repo/test_wavs/0.wav \
$repo/test_wavs/1.wav \
$repo/test_wavs/8k.wav
log "test int8 models"
time $EXE \
--tokens=$repo/tokens.txt \
--wenet-ctc-model=$repo/model.int8.onnx \
$repo/test_wavs/0.wav \
$repo/test_wavs/1.wav \
$repo/test_wavs/8k.wav
rm -rf $repo
done
log "------------------------------------------------------------"
log "Run tdnn yesno (Hebrew)"

View File

@@ -184,35 +184,13 @@ rm -rf $repo
log "------------------------------------------------------------"
log "Run Paraformer (Chinese)"
log "------------------------------------------------------------"
repo_url=https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
curl -SL -O $repo_url
tar xvf sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
rm sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
repo=sherpa-onnx-paraformer-zh-2023-03-28
log "Start testing ${repo_url}"
time $EXE \
--tokens=$repo/tokens.txt \
--paraformer=$repo/model.onnx \
--num-threads=2 \
--decoding-method=greedy_search \
$repo/test_wavs/0.wav \
$repo/test_wavs/1.wav \
$repo/test_wavs/2.wav \
$repo/test_wavs/8k.wav
time $EXE \
--tokens=$repo/tokens.txt \
--paraformer=$repo/model.int8.onnx \
--num-threads=2 \
--decoding-method=greedy_search \
$repo/test_wavs/0.wav \
$repo/test_wavs/1.wav \
$repo/test_wavs/2.wav \
$repo/test_wavs/8k.wav
rm -rf $repo
# For onnxruntime 1.18.0, sherpa-onnx-paraformer-zh-2023-03-28 throws the following error
# libc++abi: terminating with uncaught exception of type Ort::Exception: Node (Loop_5471)
# Op (Loop) [TypeInferenceError] Graph attribute inferencing failed: Node (Concat_5490)
# Op (Concat) [ShapeInferenceError] All inputs to Concat must have same rank. Input 1 has rank 2 != 1
#
# See https://github.com/microsoft/onnxruntime/issues/8115
# We need to re-export this model using a recent version of onnxruntime and onnx
log "------------------------------------------------------------"
log "Run Paraformer (Chinese) with timestamps"

View File

@@ -312,13 +312,13 @@ log "Test non-streaming paraformer models"
if [[ x$OS != x'windows-latest' ]]; then
echo "OS: $OS"
pushd $dir
repo_url=https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
repo_url=https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
curl -SL -O $repo_url
tar xvf sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
rm sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
tar xvf sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
rm sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
log "Start testing ${repo_url}"
repo=$dir/sherpa-onnx-paraformer-zh-2023-03-28
repo=$dir/sherpa-onnx-paraformer-zh-2023-09-14
ls -lh $repo
popd
@@ -348,7 +348,7 @@ if [[ x$OS != x'windows-latest' ]]; then
python3 ./python-api-examples/inverse-text-normalization-offline-asr.py
rm -rfv sherpa-onnx-paraformer-zh-2023-03-28
rm -rfv sherpa-onnx-paraformer-zh-2023-09-14
rm -rf $repo
fi

View File

@@ -172,7 +172,6 @@ jobs:
if [[ $lib_type == "shared" ]]; then
cp -a build-arm-linux-gnueabihf/install/lib $dst/
rm -v $dst/lib/libasound.so
rm -v $dst/lib/libonnxruntime.so
fi
tree $dst

View File

@@ -73,7 +73,14 @@ jobs:
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-zh-wenet-aishell main || true
cd ..
rm -rf huggingface
rm -rf huggingface/.git
dst=sherpa-onnx-zh-wenet-aishell
mv huggingface $dst
tar cjvf $dst.tar.bz2 $dst
rm -rf $dst
- name: Publish to huggingface (aishell2)
env:
@@ -115,7 +122,14 @@ jobs:
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-zh-wenet-aishell2 main || true
cd ..
rm -rf huggingface
rm -rf huggingface/.git
dst=sherpa-onnx-zh-wenet-aishell2
mv huggingface $dst
tar cjvf $dst.tar.bz2 $dst
rm -rf $dst
- name: Publish to huggingface (multi_cn)
env:
@@ -157,7 +171,14 @@ jobs:
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-zh-wenet-multi-cn main || true
cd ..
rm -rf huggingface
rm -rf huggingface/.git
dst=sherpa-onnx-zh-wenet-multi-cn
mv huggingface $dst
tar cjvf $dst.tar.bz2 $dst
rm -rf $dst
- name: Publish to huggingface (wenetspeech)
env:
@@ -199,7 +220,14 @@ jobs:
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-zh-wenet-wenetspeech main || true
cd ..
rm -rf huggingface
rm -rf huggingface/.git
dst=sherpa-onnx-zh-wenet-wenetspeech
mv huggingface $dst
tar cjvf $dst.tar.bz2 $dst
rm -rf $dst
- name: Publish to huggingface (librispeech)
env:
@@ -242,7 +270,14 @@ jobs:
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-en-wenet-librispeech main || true
cd ..
rm -rf huggingface
rm -rf huggingface/.git
dst=sherpa-onnx-en-wenet-librispeech
mv huggingface $dst
tar cjvf $dst.tar.bz2 $dst
rm -rf $dst
- name: Publish to huggingface (gigaspeech)
env:
@@ -285,4 +320,21 @@ jobs:
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-en-wenet-gigaspeech main || true
cd ..
rm -rf huggingface
rm -rf huggingface/.git
dst=sherpa-onnx-en-wenet-gigaspeech
mv huggingface $dst
tar cjvf $dst.tar.bz2 $dst
rm -rf $dst
- name: Release
uses: svenstaro/upload-release-action@v2
with:
file_glob: true
file: ./*.tar.bz2
overwrite: true
repo_name: k2-fsa/sherpa-onnx
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
tag: asr-models

View File

@@ -85,7 +85,6 @@ jobs:
make install
ls -lh ./install/lib
rm -v ./install/lib/libonnxruntime.so
- name: Copy pre-built libs
shell: bash

View File

@@ -269,7 +269,7 @@ jobs:
echo "Test paraformer"
./run-paraformer.sh
rm -rf sherpa-onnx-paraformer-zh-2023-03-28
rm -rf sherpa-onnx-paraformer-zh-2023-09-14
echo "Test NeMo CTC"
./run-nemo-ctc.sh
@@ -306,7 +306,7 @@ jobs:
echo "Test paraformer"
./run-paraformer.sh
rm -rf sherpa-onnx-paraformer-zh-2023-03-28
rm -rf sherpa-onnx-paraformer-zh-2023-09-14
echo "Test NeMo CTC"
./run-nemo-ctc.sh
@@ -351,7 +351,7 @@ jobs:
echo "Test paraformer"
./run-paraformer.sh
rm -rf sherpa-onnx-paraformer-zh-2023-03-28
rm -rf sherpa-onnx-paraformer-zh-2023-09-14
echo "Test NeMo CTC"
./run-nemo-ctc.sh

View File

@@ -94,11 +94,6 @@ jobs:
cp -v _deps/onnxruntime-src/lib/libonnxruntime*so* $upload_dir
cp -v _deps/onnxruntime-src/lib/libonnxruntime*so* ./lib/
rm -v ./lib/libonnxruntime.so
cd lib
ln -s libonnxruntime.so.1.17.1 libonnxruntime.so
cd ..
rm -v ./lib/*.a
ls -h ./lib
@@ -121,7 +116,7 @@ jobs:
rm ./lib/*.a
rm ./lib/libonnxruntime.dylib
cd lib
ln -s libonnxruntime.1.17.1.dylib libonnxruntime.dylib
ln -s libonnxruntime.1.18.0.dylib libonnxruntime.dylib
cd ..
fi
@@ -211,7 +206,7 @@ jobs:
echo "Test paraformer"
./run-paraformer.sh
./run-paraformer-itn.sh
rm -rf sherpa-onnx-paraformer-zh-2023-03-28
rm -rf sherpa-onnx-paraformer-zh-2023-09-14
echo "Test NeMo CTC"
./run-nemo-ctc.sh

View File

@@ -104,13 +104,13 @@ jobs:
if: matrix.model_type == 'paraformer' && matrix.os != 'windows-latest'
shell: bash
run: |
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
tar xvf sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
rm sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
tar xvf sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
rm sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2
python3 ./python-api-examples/non_streaming_server.py \
--paraformer ./sherpa-onnx-paraformer-zh-2023-03-28/model.int8.onnx \
--tokens ./sherpa-onnx-paraformer-zh-2023-03-28/tokens.txt &
--paraformer ./sherpa-onnx-paraformer-zh-2023-09-14/model.int8.onnx \
--tokens ./sherpa-onnx-paraformer-zh-2023-09-14/tokens.txt &
echo "sleep 10 seconds to wait the server start"
sleep 10
@@ -120,16 +120,16 @@ jobs:
shell: bash
run: |
python3 ./python-api-examples/offline-websocket-client-decode-files-paralell.py \
./sherpa-onnx-paraformer-zh-2023-03-28/test_wavs/0.wav \
./sherpa-onnx-paraformer-zh-2023-03-28/test_wavs/1.wav \
./sherpa-onnx-paraformer-zh-2023-03-28/test_wavs/2.wav \
./sherpa-onnx-paraformer-zh-2023-03-28/test_wavs/8k.wav
./sherpa-onnx-paraformer-zh-2023-09-14/test_wavs/0.wav \
./sherpa-onnx-paraformer-zh-2023-09-14/test_wavs/1.wav \
./sherpa-onnx-paraformer-zh-2023-09-14/test_wavs/2.wav \
./sherpa-onnx-paraformer-zh-2023-09-14/test_wavs/8k.wav
python3 ./python-api-examples/offline-websocket-client-decode-files-sequential.py \
./sherpa-onnx-paraformer-zh-2023-03-28/test_wavs/0.wav \
./sherpa-onnx-paraformer-zh-2023-03-28/test_wavs/1.wav \
./sherpa-onnx-paraformer-zh-2023-03-28/test_wavs/2.wav \
./sherpa-onnx-paraformer-zh-2023-03-28/test_wavs/8k.wav
./sherpa-onnx-paraformer-zh-2023-09-14/test_wavs/0.wav \
./sherpa-onnx-paraformer-zh-2023-09-14/test_wavs/1.wav \
./sherpa-onnx-paraformer-zh-2023-09-14/test_wavs/2.wav \
./sherpa-onnx-paraformer-zh-2023-09-14/test_wavs/8k.wav
- name: Start server for nemo_ctc models
if: matrix.model_type == 'nemo_ctc'