Skip to content

Commit

Permalink
Support onnxruntime 1.18.0 (#906)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Jul 10, 2024
1 parent 9e446b8 commit dd0ff2c
Show file tree
Hide file tree
Showing 107 changed files with 647 additions and 604 deletions.
8 changes: 4 additions & 4 deletions .github/scripts/test-nodejs-addon-npm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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----------"

Expand Down
16 changes: 8 additions & 8 deletions .github/scripts/test-nodejs-npm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
80 changes: 43 additions & 37 deletions .github/scripts/test-offline-ctc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)"
Expand Down
36 changes: 7 additions & 29 deletions .github/scripts/test-offline-transducer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions .github/scripts/test-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/arm-linux-gnueabihf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
64 changes: 58 additions & 6 deletions .github/workflows/export-wenet-to-onnx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,14 @@ jobs:
git push https://csukuangfj:[email protected]/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:
Expand Down Expand Up @@ -115,7 +122,14 @@ jobs:
git push https://csukuangfj:[email protected]/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:
Expand Down Expand Up @@ -157,7 +171,14 @@ jobs:
git push https://csukuangfj:[email protected]/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:
Expand Down Expand Up @@ -199,7 +220,14 @@ jobs:
git push https://csukuangfj:[email protected]/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:
Expand Down Expand Up @@ -242,7 +270,14 @@ jobs:
git push https://csukuangfj:[email protected]/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:
Expand Down Expand Up @@ -285,4 +320,21 @@ jobs:
git push https://csukuangfj:[email protected]/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
1 change: 0 additions & 1 deletion .github/workflows/release-dart-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ jobs:
make install
ls -lh ./install/lib
rm -v ./install/lib/libonnxruntime.so
- name: Copy pre-built libs
shell: bash
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-go-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit dd0ff2c

Please sign in to comment.