Test int8 models (#107)
* Test int8 models * Fix displaying help messages * small fixes * Fix jni test
This commit is contained in:
2
.github/scripts/Main.kt
vendored
2
.github/scripts/Main.kt
vendored
@@ -35,7 +35,7 @@ fun main() {
|
||||
|
||||
var objArray = WaveReader.readWave(
|
||||
assetManager = AssetManager(),
|
||||
filename = "./sherpa-onnx-streaming-zipformer-en-2023-02-21/test_wavs/1089-134686-0001.wav",
|
||||
filename = "./sherpa-onnx-streaming-zipformer-en-2023-02-21/test_wavs/0.wav",
|
||||
)
|
||||
var samples : FloatArray = objArray[0] as FloatArray
|
||||
var sampleRate : Int = objArray[1] as Int
|
||||
|
||||
33
.github/scripts/test-offline-transducer.sh
vendored
33
.github/scripts/test-offline-transducer.sh
vendored
@@ -25,6 +25,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
|
||||
|
||||
time $EXE \
|
||||
@@ -37,6 +38,16 @@ time $EXE \
|
||||
$repo/test_wavs/1.wav \
|
||||
$repo/test_wavs/8k.wav
|
||||
|
||||
time $EXE \
|
||||
--tokens=$repo/tokens.txt \
|
||||
--encoder=$repo/encoder-epoch-99-avg-1.int8.onnx \
|
||||
--decoder=$repo/decoder-epoch-99-avg-1.int8.onnx \
|
||||
--joiner=$repo/joiner-epoch-99-avg-1.int8.onnx \
|
||||
--num-threads=2 \
|
||||
$repo/test_wavs/0.wav \
|
||||
$repo/test_wavs/1.wav \
|
||||
$repo/test_wavs/8k.wav
|
||||
|
||||
rm -rf $repo
|
||||
|
||||
log "------------------------------------------------------------"
|
||||
@@ -51,6 +62,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
|
||||
|
||||
time $EXE \
|
||||
@@ -63,6 +75,16 @@ time $EXE \
|
||||
$repo/test_wavs/1.wav \
|
||||
$repo/test_wavs/8k.wav
|
||||
|
||||
time $EXE \
|
||||
--tokens=$repo/tokens.txt \
|
||||
--encoder=$repo/encoder-epoch-99-avg-1.int8.onnx \
|
||||
--decoder=$repo/decoder-epoch-99-avg-1.int8.onnx \
|
||||
--joiner=$repo/joiner-epoch-99-avg-1.int8.onnx \
|
||||
--num-threads=2 \
|
||||
$repo/test_wavs/0.wav \
|
||||
$repo/test_wavs/1.wav \
|
||||
$repo/test_wavs/8k.wav
|
||||
|
||||
rm -rf $repo
|
||||
|
||||
log "------------------------------------------------------------"
|
||||
@@ -77,6 +99,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
|
||||
|
||||
time $EXE \
|
||||
@@ -89,4 +112,14 @@ time $EXE \
|
||||
$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
|
||||
|
||||
74
.github/scripts/test-online-transducer.sh
vendored
74
.github/scripts/test-online-transducer.sh
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user