Test int8 models (#107)

* Test int8 models

* Fix displaying help messages

* small fixes

* Fix jni test
This commit is contained in:
Fangjun Kuang
2023-03-31 22:34:10 +08:00
committed by GitHub
parent c0620a1fe1
commit f9f9f20d37
7 changed files with 296 additions and 175 deletions

View File

@@ -25,12 +25,13 @@ log "Download pretrained model and test-data from $repo_url"
GIT_LFS_SKIP_SMUDGE=1 git clone $repo_url
pushd $repo
git lfs pull --include "*.onnx"
ls -lh *.onnx
popd
waves=(
$repo/test_wavs/1089-134686-0001.wav
$repo/test_wavs/1221-135766-0001.wav
$repo/test_wavs/1221-135766-0002.wav
$repo/test_wavs/0.wav
$repo/test_wavs/1.wav
$repo/test_wavs/8k.wav
)
for wave in ${waves[@]}; do
@@ -43,6 +44,16 @@ for wave in ${waves[@]}; do
2
done
for wave in ${waves[@]}; do
time $EXE \
$repo/tokens.txt \
$repo/encoder-epoch-99-avg-1.int8.onnx \
$repo/decoder-epoch-99-avg-1.int8.onnx \
$repo/joiner-epoch-99-avg-1.int8.onnx \
$wave \
2
done
rm -rf $repo
log "------------------------------------------------------------"
@@ -57,12 +68,13 @@ log "Download pretrained model and test-data from $repo_url"
GIT_LFS_SKIP_SMUDGE=1 git clone $repo_url
pushd $repo
git lfs pull --include "*.onnx"
ls -lh *.onnx
popd
waves=(
$repo/test_wavs/0.wav
$repo/test_wavs/1.wav
$repo/test_wavs/2.wav
$repo/test_wavs/8k.wav
)
for wave in ${waves[@]}; do
@@ -75,6 +87,16 @@ for wave in ${waves[@]}; do
2
done
for wave in ${waves[@]}; do
time $EXE \
$repo/tokens.txt \
$repo/encoder-epoch-11-avg-1.int8.onnx \
$repo/decoder-epoch-11-avg-1.int8.onnx \
$repo/joiner-epoch-11-avg-1.int8.onnx \
$wave \
2
done
rm -rf $repo
log "------------------------------------------------------------"
@@ -89,12 +111,13 @@ log "Download pretrained model and test-data from $repo_url"
GIT_LFS_SKIP_SMUDGE=1 git clone $repo_url
pushd $repo
git lfs pull --include "*.onnx"
ls -lh *.onnx
popd
waves=(
$repo/test_wavs/1089-134686-0001.wav
$repo/test_wavs/1221-135766-0001.wav
$repo/test_wavs/1221-135766-0002.wav
$repo/test_wavs/0.wav
$repo/test_wavs/1.wav
$repo/test_wavs/8k.wav
)
for wave in ${waves[@]}; do
@@ -107,10 +130,22 @@ for wave in ${waves[@]}; do
2
done
# test int8
#
for wave in ${waves[@]}; do
time $EXE \
$repo/tokens.txt \
$repo/encoder-epoch-99-avg-1.int8.onnx \
$repo/decoder-epoch-99-avg-1.int8.onnx \
$repo/joiner-epoch-99-avg-1.int8.onnx \
$wave \
2
done
rm -rf $repo
log "------------------------------------------------------------"
log "Run streaming Zipformer transducer (Bilingual, Chinse + English)"
log "Run streaming Zipformer transducer (Bilingual, Chinese + English)"
log "------------------------------------------------------------"
repo_url=https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
@@ -121,6 +156,7 @@ log "Download pretrained model and test-data from $repo_url"
GIT_LFS_SKIP_SMUDGE=1 git clone $repo_url
pushd $repo
git lfs pull --include "*.onnx"
ls -lh *.onnx
popd
waves=(
@@ -128,7 +164,7 @@ $repo/test_wavs/0.wav
$repo/test_wavs/1.wav
$repo/test_wavs/2.wav
$repo/test_wavs/3.wav
$repo/test_wavs/4.wav
$repo/test_wavs/8k.wav
)
for wave in ${waves[@]}; do
@@ -141,6 +177,16 @@ for wave in ${waves[@]}; do
2
done
for wave in ${waves[@]}; do
time $EXE \
$repo/tokens.txt \
$repo/encoder-epoch-99-avg-1.int8.onnx \
$repo/decoder-epoch-99-avg-1.int8.onnx \
$repo/joiner-epoch-99-avg-1.int8.onnx \
$wave \
2
done
# Decode a URL
if [ $EXE == "sherpa-onnx-ffmpeg" ]; then
time $EXE \
@@ -152,4 +198,14 @@ if [ $EXE == "sherpa-onnx-ffmpeg" ]; then
2
fi
if [ $EXE == "sherpa-onnx-ffmpeg" ]; then
time $EXE \
$repo/tokens.txt \
$repo/encoder-epoch-99-avg-1.int8.onnx \
$repo/decoder-epoch-99-avg-1.int8.onnx \
$repo/joiner-epoch-99-avg-1.int8.onnx \
https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/resolve/main/test_wavs/4.wav \
2
fi
rm -rf $repo