diff --git a/.github/scripts/test-kws.sh b/.github/scripts/test-kws.sh index 8feb43fbc..44264a53b 100755 --- a/.github/scripts/test-kws.sh +++ b/.github/scripts/test-kws.sh @@ -22,7 +22,7 @@ log "Start testing ${repo_url}" repo=sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01 log "Download pretrained model and test-data from $repo_url" -wget -qq $repo_url +curl -SL -O $repo_url tar jxvf ${repo}.tar.bz time $EXE \ @@ -47,7 +47,7 @@ log "Start testing ${repo_url}" repo=sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01 log "Download pretrained model and test-data from $repo_url" -wget -qq $repo_url +curl -SL -O $repo_url tar jxvf ${repo}.tar.bz time $EXE \ diff --git a/.github/scripts/test-python.sh b/.github/scripts/test-python.sh index befaab483..b454d5310 100755 --- a/.github/scripts/test-python.sh +++ b/.github/scripts/test-python.sh @@ -12,33 +12,46 @@ mkdir -p /tmp/icefall-models dir=/tmp/icefall-models pushd $dir -wget -qq https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13.tar.bz2 -tar xvf sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13.tar.bz2 -rm sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13.tar.bz2 + +repo=$dir/icefall-asr-librispeech-streaming-zipformer-small-2024-03-18 +mkdir -p $repo +cd $repo +mkdir exp-ctc-rnnt-small +cd exp-ctc-rnnt-small +curl -LS -O https://huggingface.co/csukuangfj/icefall-asr-librispeech-streaming-zipformer-small-2024-03-18/resolve/main/exp-ctc-rnnt-small/ctc-epoch-30-avg-3-chunk-16-left-128.int8.onnx +cd .. +mkdir -p data/lang_bpe_500 +cd data/lang_bpe_500 +curl -LS -O https://huggingface.co/csukuangfj/icefall-asr-librispeech-streaming-zipformer-small-2024-03-18/resolve/main/data/lang_bpe_500/tokens.txt +cd ../.. +mkdir test_wavs +cd test_wavs + +curl -LS -O https://huggingface.co/csukuangfj/icefall-asr-librispeech-streaming-zipformer-small-2024-03-18/resolve/main/test_wavs/0.wav +curl -LS -O https://huggingface.co/csukuangfj/icefall-asr-librispeech-streaming-zipformer-small-2024-03-18/resolve/main/test_wavs/1.wav +curl -LS -O https://huggingface.co/csukuangfj/icefall-asr-librispeech-streaming-zipformer-small-2024-03-18/resolve/main/test_wavs/8k.wav popd -repo=$dir/sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13 python3 ./python-api-examples/online-decode-files.py \ - --tokens=$repo/tokens.txt \ - --zipformer2-ctc=$repo/ctc-epoch-20-avg-1-chunk-16-left-128.onnx \ - $repo/test_wavs/DEV_T0000000000.wav \ - $repo/test_wavs/DEV_T0000000001.wav \ - $repo/test_wavs/DEV_T0000000002.wav + --tokens=$repo/data/lang_bpe_500/tokens.txt \ + --zipformer2-ctc=$repo/exp-ctc-rnnt-small/ctc-epoch-30-avg-3-chunk-16-left-128.int8.onnx \ + $repo/test_wavs/0.wav \ + $repo/test_wavs/1.wav \ + $repo/test_wavs/8k.wav -python3 sherpa-onnx/python/tests/test_offline_recognizer.py --verbose +rm -rf $repo -rm -rf $dir/sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13 +python3 sherpa-onnx/python/tests/test_offline_recognizer.py --verbose 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-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://huggingface.co/csukuangfj/$name log "Start testing ${repo_url}" @@ -78,9 +91,9 @@ mkdir ./tts log "vits-ljs test" -wget -qq https://huggingface.co/csukuangfj/vits-ljs/resolve/main/vits-ljs.onnx -wget -qq https://huggingface.co/csukuangfj/vits-ljs/resolve/main/lexicon.txt -wget -qq https://huggingface.co/csukuangfj/vits-ljs/resolve/main/tokens.txt +curl -LS -O https://huggingface.co/csukuangfj/vits-ljs/resolve/main/vits-ljs.onnx +curl -LS -O https://huggingface.co/csukuangfj/vits-ljs/resolve/main/lexicon.txt +curl -LS -O https://huggingface.co/csukuangfj/vits-ljs/resolve/main/tokens.txt python3 ./python-api-examples/offline-tts.py \ --vits-model=./vits-ljs.onnx \ @@ -94,9 +107,9 @@ ls -lh ./tts rm -v vits-ljs.onnx ./lexicon.txt ./tokens.txt log "vits-vctk test" -wget -qq https://huggingface.co/csukuangfj/vits-vctk/resolve/main/vits-vctk.onnx -wget -qq https://huggingface.co/csukuangfj/vits-vctk/resolve/main/lexicon.txt -wget -qq https://huggingface.co/csukuangfj/vits-vctk/resolve/main/tokens.txt +curl -LS -O https://huggingface.co/csukuangfj/vits-vctk/resolve/main/vits-vctk.onnx +curl -LS -O https://huggingface.co/csukuangfj/vits-vctk/resolve/main/lexicon.txt +curl -LS -O https://huggingface.co/csukuangfj/vits-vctk/resolve/main/tokens.txt for sid in 0 10 90; do python3 ./python-api-examples/offline-tts.py \ @@ -110,74 +123,81 @@ done rm -v vits-vctk.onnx ./lexicon.txt ./tokens.txt -log "vits-zh-aishell3" +if [[ x$OS != x'windows-latest' ]]; then + echo "OS: $OS" -wget -qq https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/vits-aishell3.onnx -wget -qq https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/lexicon.txt -wget -qq https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/tokens.txt + log "vits-zh-aishell3" -for sid in 0 10 90; do - python3 ./python-api-examples/offline-tts.py \ - --vits-model=./vits-aishell3.onnx \ - --vits-lexicon=./lexicon.txt \ - --vits-tokens=./tokens.txt \ - --sid=$sid \ - --output-filename=./tts/vits-aishell3-${sid}.wav \ - '林美丽最美丽' -done + curl -LS -O https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/vits-aishell3.onnx + curl -LS -O https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/lexicon.txt + curl -LS -O https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/tokens.txt -rm -v vits-aishell3.onnx ./lexicon.txt ./tokens.txt + for sid in 0 10 90; do + python3 ./python-api-examples/offline-tts.py \ + --vits-model=./vits-aishell3.onnx \ + --vits-lexicon=./lexicon.txt \ + --vits-tokens=./tokens.txt \ + --sid=$sid \ + --output-filename=./tts/vits-aishell3-${sid}.wav \ + '林美丽最美丽' + done + + rm -v vits-aishell3.onnx ./lexicon.txt ./tokens.txt +fi mkdir -p /tmp/icefall-models dir=/tmp/icefall-models log "Test streaming transducer models" -pushd $dir -repo_url=https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 +if [[ x$OS != x'windows-latest' ]]; then + echo "OS: $OS" + pushd $dir + repo_url=https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 -log "Start testing ${repo_url}" -repo=$dir/$(basename $repo_url) -log "Download pretrained model and test-data from $repo_url" + log "Start testing ${repo_url}" + repo=$dir/$(basename $repo_url) + log "Download pretrained model and test-data from $repo_url" -GIT_LFS_SKIP_SMUDGE=1 git clone $repo_url -cd $repo -git lfs pull --include "*.onnx" -popd + GIT_LFS_SKIP_SMUDGE=1 git clone $repo_url + cd $repo + git lfs pull --include "*.onnx" + popd -python3 -c "import sherpa_onnx; print(sherpa_onnx.__file__)" -sherpa_onnx_version=$(python3 -c "import sherpa_onnx; print(sherpa_onnx.__version__)") + python3 -c "import sherpa_onnx; print(sherpa_onnx.__file__)" + sherpa_onnx_version=$(python3 -c "import sherpa_onnx; print(sherpa_onnx.__version__)") -echo "sherpa_onnx version: $sherpa_onnx_version" + echo "sherpa_onnx version: $sherpa_onnx_version" -pwd -ls -lh + pwd + ls -lh -ls -lh $repo + ls -lh $repo -python3 ./python-api-examples/online-decode-files.py \ - --tokens=$repo/tokens.txt \ - --encoder=$repo/encoder-epoch-99-avg-1.onnx \ - --decoder=$repo/decoder-epoch-99-avg-1.onnx \ - --joiner=$repo/joiner-epoch-99-avg-1.onnx \ - $repo/test_wavs/0.wav \ - $repo/test_wavs/1.wav \ - $repo/test_wavs/2.wav \ - $repo/test_wavs/3.wav \ - $repo/test_wavs/8k.wav + python3 ./python-api-examples/online-decode-files.py \ + --tokens=$repo/tokens.txt \ + --encoder=$repo/encoder-epoch-99-avg-1.onnx \ + --decoder=$repo/decoder-epoch-99-avg-1.onnx \ + --joiner=$repo/joiner-epoch-99-avg-1.onnx \ + $repo/test_wavs/0.wav \ + $repo/test_wavs/1.wav \ + $repo/test_wavs/2.wav \ + $repo/test_wavs/3.wav \ + $repo/test_wavs/8k.wav -python3 ./python-api-examples/online-decode-files.py \ - --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 \ - $repo/test_wavs/0.wav \ - $repo/test_wavs/1.wav \ - $repo/test_wavs/2.wav \ - $repo/test_wavs/3.wav \ - $repo/test_wavs/8k.wav + python3 ./python-api-examples/online-decode-files.py \ + --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 \ + $repo/test_wavs/0.wav \ + $repo/test_wavs/1.wav \ + $repo/test_wavs/2.wav \ + $repo/test_wavs/3.wav \ + $repo/test_wavs/8k.wav -python3 sherpa-onnx/python/tests/test_online_recognizer.py --verbose + python3 sherpa-onnx/python/tests/test_online_recognizer.py --verbose +fi log "Test non-streaming transducer models" @@ -219,39 +239,42 @@ rm -rf $repo log "Test non-streaming paraformer models" -pushd $dir -repo_url=https://huggingface.co/csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28 +if [[ x$OS != x'windows-latest' ]]; then + echo "OS: $OS" + pushd $dir + repo_url=https://huggingface.co/csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28 -log "Start testing ${repo_url}" -repo=$dir/$(basename $repo_url) -log "Download pretrained model and test-data from $repo_url" + log "Start testing ${repo_url}" + repo=$dir/$(basename $repo_url) + log "Download pretrained model and test-data from $repo_url" -GIT_LFS_SKIP_SMUDGE=1 git clone $repo_url -cd $repo -git lfs pull --include "*.onnx" -popd + GIT_LFS_SKIP_SMUDGE=1 git clone $repo_url + cd $repo + git lfs pull --include "*.onnx" + popd -ls -lh $repo + ls -lh $repo -python3 ./python-api-examples/offline-decode-files.py \ - --tokens=$repo/tokens.txt \ - --paraformer=$repo/model.onnx \ - $repo/test_wavs/0.wav \ - $repo/test_wavs/1.wav \ - $repo/test_wavs/2.wav \ - $repo/test_wavs/8k.wav + python3 ./python-api-examples/offline-decode-files.py \ + --tokens=$repo/tokens.txt \ + --paraformer=$repo/model.onnx \ + $repo/test_wavs/0.wav \ + $repo/test_wavs/1.wav \ + $repo/test_wavs/2.wav \ + $repo/test_wavs/8k.wav -python3 ./python-api-examples/offline-decode-files.py \ - --tokens=$repo/tokens.txt \ - --paraformer=$repo/model.int8.onnx \ - $repo/test_wavs/0.wav \ - $repo/test_wavs/1.wav \ - $repo/test_wavs/2.wav \ - $repo/test_wavs/8k.wav + python3 ./python-api-examples/offline-decode-files.py \ + --tokens=$repo/tokens.txt \ + --paraformer=$repo/model.int8.onnx \ + $repo/test_wavs/0.wav \ + $repo/test_wavs/1.wav \ + $repo/test_wavs/2.wav \ + $repo/test_wavs/8k.wav -python3 sherpa-onnx/python/tests/test_offline_recognizer.py --verbose + python3 sherpa-onnx/python/tests/test_offline_recognizer.py --verbose -rm -rf $repo + rm -rf $repo +fi log "Test non-streaming NeMo CTC models" @@ -294,8 +317,8 @@ python3 sherpa-onnx/python/tests/test_text2token.py --verbose rm -rf /tmp/sherpa-test-data -mkdir -p /tmp/onnx-models dir=/tmp/onnx-models +mkdir -p $dir log "Test keyword spotting models" @@ -311,7 +334,7 @@ repo=sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01 log "Start testing ${repo}" pushd $dir -wget -qq https://github.com/pkufool/keyword-spotting-models/releases/download/v0.1/sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01.tar.bz +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 popd @@ -327,27 +350,35 @@ python3 ./python-api-examples/keyword-spotter.py \ $repo/test_wavs/0.wav \ $repo/test_wavs/1.wav -repo=sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01 -log "Start testing ${repo}" +rm -rf $repo -pushd $dir -wget -qq https://github.com/pkufool/keyword-spotting-models/releases/download/v0.1/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz -tar xf sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz -popd +if [[ x$OS != x'windows-latest' ]]; then + echo "OS: $OS" -repo=$dir/$repo -ls -lh $repo + repo=sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01 + log "Start testing ${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 + pushd $dir + curl -LS -O https://github.com/pkufool/keyword-spotting-models/releases/download/v0.1/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz + tar xf sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz + popd -python3 sherpa-onnx/python/tests/test_keyword_spotter.py --verbose + 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 sherpa-onnx/python/tests/test_keyword_spotter.py --verbose + + rm -rf $repo +fi rm -r $dir diff --git a/.github/scripts/test-speaker-recognition-python.sh b/.github/scripts/test-speaker-recognition-python.sh index 22b1367de..c991fd66a 100755 --- a/.github/scripts/test-speaker-recognition-python.sh +++ b/.github/scripts/test-speaker-recognition-python.sh @@ -32,8 +32,8 @@ wespeaker_zh_cnceleb_resnet34.onnx wespeaker_zh_cnceleb_resnet34_LM.onnx ) for m in ${models[@]}; do - wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/$m - wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/wespeaker_en_voxceleb_CAM++_LM.onnx + curl -LS -O https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/$m + curl -LS -O https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/wespeaker_en_voxceleb_CAM++_LM.onnx done ls -lh popd @@ -52,7 +52,7 @@ models=( 3dspeaker_speech_eres2net_sv_zh-cn_16k-common.onnx ) for m in ${models[@]}; do - wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/$m + curl -LS -O https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/$m done ls -lh popd @@ -67,7 +67,7 @@ nemo_en_titanet_small.onnx nemo_en_speakerverification_speakernet.onnx ) for m in ${models[@]}; do - wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/$m + curl -LS -O https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/$m done ls -lh popd diff --git a/.github/scripts/test-swift.sh b/.github/scripts/test-swift.sh index 15642ebc5..9e9f82c24 100755 --- a/.github/scripts/test-swift.sh +++ b/.github/scripts/test-swift.sh @@ -9,7 +9,7 @@ ls -lh mkdir -p /Users/fangjun/Desktop pushd /Users/fangjun/Desktop -wget -q https://huggingface.co/csukuangfj/test-data/resolve/main/Obama.wav +curl -SL -O https://huggingface.co/csukuangfj/test-data/resolve/main/Obama.wav ls -lh popd diff --git a/.github/workflows/aarch64-linux-gnu-shared.yaml b/.github/workflows/aarch64-linux-gnu-shared.yaml index cb095aaf4..a5df2c9c0 100644 --- a/.github/workflows/aarch64-linux-gnu-shared.yaml +++ b/.github/workflows/aarch64-linux-gnu-shared.yaml @@ -84,16 +84,16 @@ jobs: uses: actions/cache@v4 with: path: toolchain - key: gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz + key: gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz - name: Download toolchain if: steps.cache-toolchain.outputs.cache-hit != 'true' shell: bash run: | - wget -qq https://huggingface.co/csukuangfj/sherpa-ncnn-toolchains/resolve/main/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz + wget -qq https://huggingface.co/csukuangfj/sherpa-ncnn-toolchains/resolve/main/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz mkdir $GITHUB_WORKSPACE/toolchain - tar xf ./gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz --strip-components 1 -C $GITHUB_WORKSPACE/toolchain + tar xf ./gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz --strip-components 1 -C $GITHUB_WORKSPACE/toolchain - name: Set environment variable if: steps.cache-build-result.outputs.cache-hit != 'true' @@ -103,19 +103,19 @@ jobs: echo "$GITHUB_WORKSPACE/bin" >> "$GITHUB_PATH" ls -lh "$GITHUB_WORKSPACE/toolchain/bin" - echo "CC=aarch64-none-linux-gnu-gcc" >> "$GITHUB_ENV" - echo "CXX=aarch64-none-linux-gnu-g++" >> "$GITHUB_ENV" + echo "CC=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV" + echo "CXX=aarch64-linux-gnu-g++" >> "$GITHUB_ENV" - name: Display toolchain info shell: bash run: | - aarch64-none-linux-gnu-gcc --version + aarch64-linux-gnu-gcc --version - name: Display qemu-aarch64 -h shell: bash run: | export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH - export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/aarch64-none-linux-gnu/libc + export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/aarch64-linux-gnu/libc qemu-aarch64 -h - name: build aarch64-linux-gnu @@ -140,7 +140,7 @@ jobs: run: | export PATH=$GITHUB_WORKSPACE/toolchain/bin:$PATH export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH - export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/aarch64-none-linux-gnu/libc + export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/aarch64-linux-gnu/libc ls -lh ./build-aarch64-linux-gnu/bin @@ -151,7 +151,7 @@ jobs: - name: Copy files shell: bash run: | - aarch64-none-linux-gnu-strip --version + aarch64-linux-gnu-strip --version SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) @@ -166,7 +166,7 @@ jobs: ls -lh $dst/bin/ echo "strip" - aarch64-none-linux-gnu-strip $dst/bin/* + aarch64-linux-gnu-strip $dst/bin/* tree $dst @@ -177,6 +177,38 @@ jobs: name: sherpa-onnx-linux-aarch64-shared path: sherpa-onnx-*linux-aarch64-shared.tar.bz2 + # https://huggingface.co/docs/hub/spaces-github-actions + - name: Publish to huggingface + if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' + env: + HF_TOKEN: ${{ secrets.HF_TOKEN }} + uses: nick-fields/retry@v3 + with: + max_attempts: 20 + timeout_seconds: 200 + shell: bash + command: | + git config --global user.email "csukuangfj@gmail.com" + git config --global user.name "Fangjun Kuang" + + rm -rf huggingface + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface + + cd huggingface + git lfs pull + mkdir -p aarch64 + + cp -v ../sherpa-onnx-*-shared.tar.bz2 ./aarch64 + + git status + git lfs track "*.bz2" + + git add . + + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-aarch64-shared.tar.bz2" + + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main + - name: Release pre-compiled binaries and libs for aarch64 linux if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') uses: svenstaro/upload-release-action@v2 diff --git a/.github/workflows/aarch64-linux-gnu-static.yaml b/.github/workflows/aarch64-linux-gnu-static.yaml index c3e0bce9d..3c6e6b36c 100644 --- a/.github/workflows/aarch64-linux-gnu-static.yaml +++ b/.github/workflows/aarch64-linux-gnu-static.yaml @@ -168,6 +168,38 @@ jobs: name: sherpa-onnx-linux-aarch64-static path: sherpa-onnx-*linux-aarch64-static.tar.bz2 + # https://huggingface.co/docs/hub/spaces-github-actions + - name: Publish to huggingface + if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' + env: + HF_TOKEN: ${{ secrets.HF_TOKEN }} + uses: nick-fields/retry@v3 + with: + max_attempts: 20 + timeout_seconds: 200 + shell: bash + command: | + git config --global user.email "csukuangfj@gmail.com" + git config --global user.name "Fangjun Kuang" + + rm -rf huggingface + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface + + cd huggingface + git lfs pull + mkdir -p aarch64 + + cp -v ../sherpa-onnx-*-static.tar.bz2 ./aarch64 + + git status + git lfs track "*.bz2" + + git add . + + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-aarch64-static.tar.bz2" + + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main + - name: Release pre-compiled binaries and libs for aarch64 linux if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') uses: svenstaro/upload-release-action@v2 diff --git a/.github/workflows/arm-linux-gnueabihf.yaml b/.github/workflows/arm-linux-gnueabihf.yaml index 00b7223ad..ee348b940 100644 --- a/.github/workflows/arm-linux-gnueabihf.yaml +++ b/.github/workflows/arm-linux-gnueabihf.yaml @@ -191,6 +191,38 @@ jobs: name: sherpa-onnx-linux-arm-gnueabihf-static path: sherpa-onnx-*linux-arm-gnueabihf-static.tar.bz2 + # https://huggingface.co/docs/hub/spaces-github-actions + - name: Publish to huggingface + if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' + env: + HF_TOKEN: ${{ secrets.HF_TOKEN }} + uses: nick-fields/retry@v3 + with: + max_attempts: 20 + timeout_seconds: 200 + shell: bash + command: | + git config --global user.email "csukuangfj@gmail.com" + git config --global user.name "Fangjun Kuang" + + rm -rf huggingface + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface + + cd huggingface + git lfs pull + mkdir -p arm32 + + cp -v ../sherpa-onnx-*.tar.bz2 ./arm32 + + git status + git lfs track "*.bz2" + + git add . + + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}" + + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main + - name: Release pre-compiled binaries and libs for arm linux gnueabihf ${{ matrix.lib_type }} if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') uses: svenstaro/upload-release-action@v2 diff --git a/.github/workflows/linux-gpu.yaml b/.github/workflows/linux-gpu.yaml index 6a7d2589e..5aa4ecfe6 100644 --- a/.github/workflows/linux-gpu.yaml +++ b/.github/workflows/linux-gpu.yaml @@ -50,7 +50,8 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - build_type: [Release, Debug] + # build_type: [Release, Debug] + build_type: [Release] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 27635ff5b..9948d560e 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -18,6 +18,7 @@ on: - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' + - 'sherpa-onnx/c-api/*' pull_request: branches: - master @@ -33,6 +34,7 @@ on: - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' + - 'sherpa-onnx/c-api/*' workflow_dispatch: diff --git a/.github/workflows/nightly-wheel-arm.yaml b/.github/workflows/nightly-wheel-arm.yaml index e52bc5afa..5d8a7cac2 100644 --- a/.github/workflows/nightly-wheel-arm.yaml +++ b/.github/workflows/nightly-wheel-arm.yaml @@ -1,10 +1,6 @@ name: nightly-wheel-arm on: - push: - branches: - - master - - nightly schedule: # minute (0-59) # hour (0-23) diff --git a/.github/workflows/riscv64-linux.yaml b/.github/workflows/riscv64-linux.yaml index f95604a6e..8d4e3c668 100644 --- a/.github/workflows/riscv64-linux.yaml +++ b/.github/workflows/riscv64-linux.yaml @@ -196,6 +196,8 @@ jobs: dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-riscv64-${{ matrix.lib_type }} mkdir $dst + cp -v $GITHUB_WORKSPACE/toolchain/sysroot/lib/ld-linux-riscv64xthead-lp64d.so.1 build-riscv64-linux-gnu/install/lib/ + ls -lh build-riscv64-linux-gnu/install/lib cp -a build-riscv64-linux-gnu/install/bin $dst/ @@ -221,6 +223,39 @@ jobs: name: sherpa-onnx-linux-riscv64-shared path: sherpa-onnx-*linux-riscv64-shared.tar.bz2 + # https://huggingface.co/docs/hub/spaces-github-actions + - name: Publish to huggingface + if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' + env: + HF_TOKEN: ${{ secrets.HF_TOKEN }} + uses: nick-fields/retry@v3 + with: + max_attempts: 20 + timeout_seconds: 200 + shell: bash + command: | + git config --global user.email "csukuangfj@gmail.com" + git config --global user.name "Fangjun Kuang" + + rm -rf huggingface + + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface + + cd huggingface + git lfs pull + mkdir -p riscv64 + + cp -v ../sherpa-onnx-*-shared.tar.bz2 ./riscv64 + + git status + git lfs track "*.bz2" + + git add . + + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-riscv64-shared.tar.bz2" + + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main + - uses: actions/upload-artifact@v4 if: matrix.lib_type == 'shared' with: diff --git a/.github/workflows/run-python-test.yaml b/.github/workflows/run-python-test.yaml index 4e6e97fd8..fcb9b1925 100644 --- a/.github/workflows/run-python-test.yaml +++ b/.github/workflows/run-python-test.yaml @@ -30,8 +30,12 @@ concurrency: permissions: contents: read +env: + SCCACHE_GHA_ENABLED: "true" + jobs: run-python-test: + name: ${{ matrix.os }} ${{ matrix.python-version }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -43,6 +47,8 @@ jobs: python-version: "3.9" - os: macos-latest python-version: "3.10" + # - os: windows-latest + # python-version: "3.12" steps: - uses: actions/checkout@v4 @@ -50,10 +56,17 @@ jobs: fetch-depth: 0 - name: ccache + if: matrix.os != 'windows-latest' uses: hendrikmuhs/ccache-action@v1.2 with: key: ${{ matrix.os }}-python-${{ matrix.python-version }} + - name: Run sccache-cache + if: matrix.os == 'windows-latest' + uses: mozilla-actions/sccache-action@v0.0.3 + with: + version: "v0.7.4" + - name: Setup Python uses: actions/setup-python@v5 with: @@ -62,9 +75,10 @@ jobs: - name: Install Python dependencies shell: bash run: | - python3 -m pip install --upgrade pip numpy pypinyin sentencepiece==0.1.96 soundfile + python3 -m pip install --upgrade pip numpy pypinyin sentencepiece>=0.1.96 soundfile - name: Install sherpa-onnx + if: matrix.os != 'windows-latest' shell: bash run: | export CMAKE_CXX_COMPILER_LAUNCHER=ccache @@ -73,11 +87,22 @@ jobs: python3 -m pip install --verbose . + - name: Install sherpa-onnx + if: matrix.os == 'windows-latest' + shell: bash + run: | + cmake --version + export SHERPA_ONNX_CMAKE_ARGS="-DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache" + echo "SHERPA_ONNX_CMAKE_ARGS: ${SHERPA_ONNX_CMAKE_ARGS}" + + python3 -m pip install --verbose . + - name: Test sherpa-onnx shell: bash run: | - .github/scripts/test-speaker-recognition-python.sh + export OS=${{ matrix.os }} .github/scripts/test-python.sh + .github/scripts/test-speaker-recognition-python.sh - uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/swift.yaml b/.github/workflows/swift.yaml index 0a68afe0e..5d3a01252 100644 --- a/.github/workflows/swift.yaml +++ b/.github/workflows/swift.yaml @@ -11,7 +11,7 @@ on: - 'cmake/**' - 'swift-api-examples/**' - 'sherpa-onnx/csrc/*' - - 'sherpa-onnx/c-api/*' + - 'sherpa-onnx/c-api/**' - '.github/scripts/test-swift.sh' pull_request: @@ -24,7 +24,7 @@ on: - 'cmake/**' - 'swift-api-examples/**' - 'sherpa-onnx/csrc/*' - - 'sherpa-onnx/c-api/*' + - 'sherpa-onnx/c-api/**' - '.github/scripts/test-swift.sh' workflow_dispatch: diff --git a/.github/workflows/test-dot-net.yaml b/.github/workflows/test-dot-net.yaml index 88c430489..6a133addc 100644 --- a/.github/workflows/test-dot-net.yaml +++ b/.github/workflows/test-dot-net.yaml @@ -4,10 +4,24 @@ on: push: branches: - master + paths: + - '.github/workflows/test-dot-net.yaml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'sherpa-onnx/csrc/*' + - 'dotnet-examples/**' + - 'scripts/dotnet/**' pull_request: branches: - master + paths: + - '.github/workflows/test-dot-net.yaml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'sherpa-onnx/csrc/*' + - 'dotnet-examples/**' + - 'scripts/dotnet/**' workflow_dispatch: diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index 25193309d..ae9b6f000 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -4,9 +4,23 @@ on: push: branches: - master + paths: + - '.github/workflows/test-go.yaml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'sherpa-onnx/csrc/*' + - 'go-api-examples/**' + - 'scripts/go/**' pull_request: branches: - master + paths: + - '.github/workflows/test-go.yaml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'sherpa-onnx/csrc/*' + - 'go-api-examples/**' + - 'scripts/go/**' workflow_dispatch: diff --git a/.github/workflows/test-nodejs.yaml b/.github/workflows/test-nodejs.yaml index 5aed09557..4ae3014c4 100644 --- a/.github/workflows/test-nodejs.yaml +++ b/.github/workflows/test-nodejs.yaml @@ -4,10 +4,26 @@ on: push: branches: - master + paths: + - '.github/workflows/test-nodejs.yaml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'sherpa-onnx/csrc/*' + - 'sherpa-onnx/c-api/*' + - 'scripts/nodejs/**' + - 'nodejs-examples/**' pull_request: branches: - master + paths: + - '.github/workflows/test-nodejs.yaml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'sherpa-onnx/csrc/*' + - 'sherpa-onnx/c-api/*' + - 'scripts/nodejs/**' + - 'nodejs-examples/**' workflow_dispatch: diff --git a/.github/workflows/test-piper-phonemize.yaml b/.github/workflows/test-piper-phonemize.yaml index ab1c39387..dd00a4901 100644 --- a/.github/workflows/test-piper-phonemize.yaml +++ b/.github/workflows/test-piper-phonemize.yaml @@ -3,6 +3,19 @@ on: push: branches: - master + paths: + - '.github/workflows/test-piper-phonemize.yaml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'sherpa-onnx/csrc/*' + pull_request: + branches: + - master + paths: + - '.github/workflows/test-piper-phonemize.yaml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'sherpa-onnx/csrc/*' workflow_dispatch: @@ -10,7 +23,6 @@ concurrency: group: test-piper-phonemize-${{ github.ref }} cancel-in-progress: true - jobs: test_piper_phonemize: name: ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.shared_lib }} diff --git a/.github/workflows/test-python-offline-websocket-server.yaml b/.github/workflows/test-python-offline-websocket-server.yaml index e030cb067..349e0b61d 100644 --- a/.github/workflows/test-python-offline-websocket-server.yaml +++ b/.github/workflows/test-python-offline-websocket-server.yaml @@ -4,9 +4,21 @@ on: push: branches: - master + paths: + - '.github/workflows/test-python-offline-websocket-server.yaml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'sherpa-onnx/csrc/*' + - 'sherpa-onnx/python/**' pull_request: branches: - master + paths: + - '.github/workflows/test-python-offline-websocket-server.yaml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'sherpa-onnx/csrc/*' + - 'sherpa-onnx/python/**' workflow_dispatch: concurrency: diff --git a/.github/workflows/test-python-online-websocket-server.yaml b/.github/workflows/test-python-online-websocket-server.yaml index d544b38c9..1f4096c0f 100644 --- a/.github/workflows/test-python-online-websocket-server.yaml +++ b/.github/workflows/test-python-online-websocket-server.yaml @@ -4,9 +4,21 @@ on: push: branches: - master + paths: + - '.github/workflows/test-python-online-websocket-server.yaml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'sherpa-onnx/csrc/*' + - 'sherpa-onnx/python/**' pull_request: branches: - master + paths: + - '.github/workflows/test-python-online-websocket-server.yaml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'sherpa-onnx/csrc/*' + - 'sherpa-onnx/python/**' workflow_dispatch: concurrency: diff --git a/.github/workflows/windows-x64.yaml b/.github/workflows/windows-x64.yaml index c9a9c0f68..6ee2314d7 100644 --- a/.github/workflows/windows-x64.yaml +++ b/.github/workflows/windows-x64.yaml @@ -40,7 +40,7 @@ concurrency: jobs: windows_x64: - name: Windows x64 + name: ${{ matrix.shared_lib }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -59,7 +59,6 @@ jobs: mkdir build cd build cmake -A x64 -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install .. - - name: Build sherpa-onnx for windows shell: bash run: | @@ -134,12 +133,17 @@ jobs: .github/scripts/test-online-transducer.sh - name: Copy files - if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') shell: bash run: | SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) - dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64 + shared_lib=${{ matrix.shared_lib }} + if [[ $shared_lib == "ON" ]]; then + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-shared + else + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-static + fi + mkdir $dst cp -a build/install/bin $dst/ @@ -148,10 +152,42 @@ jobs: tar cjvf ${dst}.tar.bz2 $dst + # https://huggingface.co/docs/hub/spaces-github-actions + - name: Publish to huggingface + if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' + env: + HF_TOKEN: ${{ secrets.HF_TOKEN }} + uses: nick-fields/retry@v3 + with: + max_attempts: 20 + timeout_seconds: 200 + shell: bash + command: | + git config --global user.email "csukuangfj@gmail.com" + git config --global user.name "Fangjun Kuang" + + rm -rf huggingface + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface + + cd huggingface + git lfs pull + mkdir -p win64 + + cp -v ../sherpa-onnx-*.tar.bz2 ./win64 + + git status + git lfs track "*.bz2" + + git add . + + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}" + + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main + - name: Release pre-compiled binaries and libs for Windows x64 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') uses: svenstaro/upload-release-action@v2 with: file_glob: true overwrite: true - file: sherpa-onnx-*-win-x64.tar.bz2 + file: sherpa-onnx-*-win-x64*.tar.bz2 diff --git a/.github/workflows/windows-x86.yaml b/.github/workflows/windows-x86.yaml index 6ed642812..c0cef5a37 100644 --- a/.github/workflows/windows-x86.yaml +++ b/.github/workflows/windows-x86.yaml @@ -134,12 +134,19 @@ jobs: .github/scripts/test-online-transducer.sh - name: Copy files - if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') shell: bash run: | SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86 + + shared_lib=${{ matrix.shared_lib }} + if [[ $shared_lib == "ON" ]]; then + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-shared + else + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-static + fi + mkdir $dst cp -a build/install/bin $dst/ @@ -148,10 +155,42 @@ jobs: tar cjvf ${dst}.tar.bz2 $dst + # https://huggingface.co/docs/hub/spaces-github-actions + - name: Publish to huggingface + if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' + env: + HF_TOKEN: ${{ secrets.HF_TOKEN }} + uses: nick-fields/retry@v3 + with: + max_attempts: 20 + timeout_seconds: 200 + shell: bash + command: | + git config --global user.email "csukuangfj@gmail.com" + git config --global user.name "Fangjun Kuang" + + rm -rf huggingface + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface + + cd huggingface + git lfs pull + mkdir -p win32 + + cp -v ../sherpa-onnx-*.tar.bz2 ./win32 + + git status + git lfs track "*.bz2" + + git add . + + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}" + + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main + - name: Release pre-compiled binaries and libs for Windows x86 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') uses: svenstaro/upload-release-action@v2 with: file_glob: true overwrite: true - file: sherpa-onnx-*-win-x86.tar.bz2 + file: sherpa-onnx-*-win-x86*.tar.bz2 diff --git a/dotnet-examples/offline-decode-files/Program.cs b/dotnet-examples/offline-decode-files/Program.cs index da90ccda1..f88c634d7 100644 --- a/dotnet-examples/offline-decode-files/Program.cs +++ b/dotnet-examples/offline-decode-files/Program.cs @@ -68,6 +68,12 @@ class Options It specifies number of active paths to keep during the search")] public int MaxActivePaths { get; set; } + [Option("hotwords-file", Required = false, Default = "", HelpText = "Path to hotwords.txt")] + public string HotwordsFile { get; set; } + + [Option("hotwords-score", Required = false, Default = 1.5F, HelpText = "hotwords score")] + public float HotwordsScore { get; set; } + [Option("files", Required = true, HelpText = "Audio files for decoding")] public IEnumerable Files { get; set; } } @@ -214,6 +220,9 @@ private static void Run(Options options) config.DecodingMethod = options.DecodingMethod; config.MaxActivePaths = options.MaxActivePaths; + config.HotwordsFile = options.HotwordsFile; + config.HotwordsScore = options.HotwordsScore; + config.ModelConfig.Debug = 0; OfflineRecognizer recognizer = new OfflineRecognizer(config); diff --git a/dotnet-examples/online-decode-files/Program.cs b/dotnet-examples/online-decode-files/Program.cs index 2e0264a89..2d94c4d16 100644 --- a/dotnet-examples/online-decode-files/Program.cs +++ b/dotnet-examples/online-decode-files/Program.cs @@ -79,6 +79,13 @@ larger than this value after something that is not blank has been decoded. Used larger than this value. Used only when --enable-endpoint is true.")] public float Rule3MinUtteranceLength { get; set; } + [Option("hotwords-file", Required = false, Default = "", HelpText = "Path to hotwords.txt")] + public string HotwordsFile { get; set; } + + [Option("hotwords-score", Required = false, Default = 1.5F, HelpText = "hotwords score")] + public float HotwordsScore { get; set; } + + [Option("files", Required = true, HelpText = "Audio files for decoding")] public IEnumerable Files { get; set; } @@ -180,6 +187,8 @@ private static void Run(Options options) config.Rule1MinTrailingSilence = options.Rule1MinTrailingSilence; config.Rule2MinTrailingSilence = options.Rule2MinTrailingSilence; config.Rule3MinUtteranceLength = options.Rule3MinUtteranceLength; + config.HotwordsFile = options.HotwordsFile; + config.HotwordsScore = options.HotwordsScore; OnlineRecognizer recognizer = new OnlineRecognizer(config); diff --git a/scripts/dotnet/.gitignore b/scripts/dotnet/.gitignore index c82f824dd..6e69e3c10 100644 --- a/scripts/dotnet/.gitignore +++ b/scripts/dotnet/.gitignore @@ -2,4 +2,6 @@ all macos linux windows +windows-x64 +windows-x86 packages diff --git a/scripts/dotnet/online.cs b/scripts/dotnet/online.cs index 47eda9ff1..dd79ba6b7 100644 --- a/scripts/dotnet/online.cs +++ b/scripts/dotnet/online.cs @@ -130,7 +130,7 @@ public OnlineRecognizerConfig() Rule2MinTrailingSilence = 2.4F; Rule3MinUtteranceLength = 20.0F; HotwordsFile = ""; - HotwordsScore = 2F; + HotwordsScore = 1.5F; } public FeatureConfig FeatConfig; public OnlineModelConfig ModelConfig;