Fix keyword spotting. (#1689)
Reset the stream right after detecting a keyword
This commit is contained in:
33
.github/scripts/test-python.sh
vendored
33
.github/scripts/test-python.sh
vendored
@@ -574,29 +574,6 @@ echo "sherpa_onnx version: $sherpa_onnx_version"
|
||||
pwd
|
||||
ls -lh
|
||||
|
||||
repo=sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01
|
||||
log "Start testing ${repo}"
|
||||
|
||||
pushd $dir
|
||||
curl -LS -O https://github.com/pkufool/keyword-spotting-models/releases/download/v0.1/sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01.tar.bz
|
||||
tar xf sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01.tar.bz
|
||||
rm sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01.tar.bz
|
||||
popd
|
||||
|
||||
repo=$dir/$repo
|
||||
ls -lh $repo
|
||||
|
||||
python3 ./python-api-examples/keyword-spotter.py \
|
||||
--tokens=$repo/tokens.txt \
|
||||
--encoder=$repo/encoder-epoch-12-avg-2-chunk-16-left-64.onnx \
|
||||
--decoder=$repo/decoder-epoch-12-avg-2-chunk-16-left-64.onnx \
|
||||
--joiner=$repo/joiner-epoch-12-avg-2-chunk-16-left-64.onnx \
|
||||
--keywords-file=$repo/test_wavs/test_keywords.txt \
|
||||
$repo/test_wavs/0.wav \
|
||||
$repo/test_wavs/1.wav
|
||||
|
||||
rm -rf $repo
|
||||
|
||||
if [[ x$OS != x'windows-latest' ]]; then
|
||||
echo "OS: $OS"
|
||||
|
||||
@@ -612,15 +589,7 @@ if [[ x$OS != x'windows-latest' ]]; then
|
||||
repo=$dir/$repo
|
||||
ls -lh $repo
|
||||
|
||||
python3 ./python-api-examples/keyword-spotter.py \
|
||||
--tokens=$repo/tokens.txt \
|
||||
--encoder=$repo/encoder-epoch-12-avg-2-chunk-16-left-64.onnx \
|
||||
--decoder=$repo/decoder-epoch-12-avg-2-chunk-16-left-64.onnx \
|
||||
--joiner=$repo/joiner-epoch-12-avg-2-chunk-16-left-64.onnx \
|
||||
--keywords-file=$repo/test_wavs/test_keywords.txt \
|
||||
$repo/test_wavs/3.wav \
|
||||
$repo/test_wavs/4.wav \
|
||||
$repo/test_wavs/5.wav
|
||||
python3 ./python-api-examples/keyword-spotter.py
|
||||
|
||||
python3 sherpa-onnx/python/tests/test_keyword_spotter.py --verbose
|
||||
|
||||
|
||||
21
.github/workflows/c-api.yaml
vendored
21
.github/workflows/c-api.yaml
vendored
@@ -79,6 +79,27 @@ jobs:
|
||||
otool -L ./install/lib/libsherpa-onnx-c-api.dylib
|
||||
fi
|
||||
|
||||
- name: Test kws (zh)
|
||||
shell: bash
|
||||
run: |
|
||||
gcc -o kws-c-api ./c-api-examples/kws-c-api.c \
|
||||
-I ./build/install/include \
|
||||
-L ./build/install/lib/ \
|
||||
-l sherpa-onnx-c-api \
|
||||
-l onnxruntime
|
||||
|
||||
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/kws-models/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile.tar.bz2
|
||||
tar xvf sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile.tar.bz2
|
||||
rm sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile.tar.bz2
|
||||
|
||||
export LD_LIBRARY_PATH=$PWD/build/install/lib:$LD_LIBRARY_PATH
|
||||
export DYLD_LIBRARY_PATH=$PWD/build/install/lib:$DYLD_LIBRARY_PATH
|
||||
|
||||
./kws-c-api
|
||||
|
||||
rm ./kws-c-api
|
||||
rm -rf sherpa-onnx-kws-*
|
||||
|
||||
- name: Test Kokoro TTS (en)
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
22
.github/workflows/cxx-api.yaml
vendored
22
.github/workflows/cxx-api.yaml
vendored
@@ -81,6 +81,28 @@ jobs:
|
||||
otool -L ./install/lib/libsherpa-onnx-cxx-api.dylib
|
||||
fi
|
||||
|
||||
- name: Test KWS (zh)
|
||||
shell: bash
|
||||
run: |
|
||||
g++ -std=c++17 -o kws-cxx-api ./cxx-api-examples/kws-cxx-api.cc \
|
||||
-I ./build/install/include \
|
||||
-L ./build/install/lib/ \
|
||||
-l sherpa-onnx-cxx-api \
|
||||
-l sherpa-onnx-c-api \
|
||||
-l onnxruntime
|
||||
|
||||
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/kws-models/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile.tar.bz2
|
||||
tar xvf sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile.tar.bz2
|
||||
rm sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile.tar.bz2
|
||||
|
||||
export LD_LIBRARY_PATH=$PWD/build/install/lib:$LD_LIBRARY_PATH
|
||||
export DYLD_LIBRARY_PATH=$PWD/build/install/lib:$DYLD_LIBRARY_PATH
|
||||
|
||||
./kws-cxx-api
|
||||
|
||||
rm kws-cxx-api
|
||||
rm -rf sherpa-onnx-kws-*
|
||||
|
||||
- name: Test Kokoro TTS (en)
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user