Fangjun Kuang
Committed by GitHub

Add hotwords support to .Net (#689)

@@ -53,6 +53,7 @@ jobs: @@ -53,6 +53,7 @@ jobs:
53 ./run-nemo-ctc.sh 53 ./run-nemo-ctc.sh
54 ./run-paraformer.sh 54 ./run-paraformer.sh
55 ./run-zipformer.sh 55 ./run-zipformer.sh
  56 + ./run-hotwords.sh
56 ./run-whisper.sh 57 ./run-whisper.sh
57 ./run-tdnn-yesno.sh 58 ./run-tdnn-yesno.sh
58 59
@@ -194,6 +194,7 @@ jobs: @@ -194,6 +194,7 @@ jobs:
194 ./run-nemo-ctc.sh 194 ./run-nemo-ctc.sh
195 ./run-paraformer.sh 195 ./run-paraformer.sh
196 ./run-zipformer.sh 196 ./run-zipformer.sh
  197 + ./run-hotwords.sh
197 ./run-whisper.sh 198 ./run-whisper.sh
198 ./run-tdnn-yesno.sh 199 ./run-tdnn-yesno.sh
199 200
  1 +#!/usr/bin/env bash
  2 +
  3 +set -ex
  4 +
  5 +if [ ! -d ./sherpa-onnx-zipformer-en-2023-04-01 ]; then
  6 + wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
  7 + tar xvf sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
  8 + rm sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
  9 +fi
  10 +
  11 +if [ ! -f ./sherpa-onnx-zipformer-en-2023-04-01/hotwords_en.txt ]; then
  12 +cat >./sherpa-onnx-zipformer-en-2023-04-01/hotwords_en.txt <<EOF
  13 +▁ QUA R TER S
  14 +▁FOR E VER
  15 +EOF
  16 +fi
  17 +
  18 +dotnet run \
  19 + --tokens=./sherpa-onnx-zipformer-en-2023-04-01/tokens.txt \
  20 + --encoder=./sherpa-onnx-zipformer-en-2023-04-01/encoder-epoch-99-avg-1.onnx \
  21 + --decoder=./sherpa-onnx-zipformer-en-2023-04-01/decoder-epoch-99-avg-1.onnx \
  22 + --joiner=./sherpa-onnx-zipformer-en-2023-04-01/joiner-epoch-99-avg-1.onnx \
  23 + --num-threads=2 \
  24 + --decoding-method=modified_beam_search \
  25 + --files ./sherpa-onnx-zipformer-en-2023-04-01/test_wavs/0.wav \
  26 + ./sherpa-onnx-zipformer-en-2023-04-01/test_wavs/1.wav
  27 +
  28 +dotnet run \
  29 + --hotwords-file=./sherpa-onnx-zipformer-en-2023-04-01/hotwords_en.txt \
  30 + --hotwords-score=2.0 \
  31 + --tokens=./sherpa-onnx-zipformer-en-2023-04-01/tokens.txt \
  32 + --encoder=./sherpa-onnx-zipformer-en-2023-04-01/encoder-epoch-99-avg-1.onnx \
  33 + --decoder=./sherpa-onnx-zipformer-en-2023-04-01/decoder-epoch-99-avg-1.onnx \
  34 + --joiner=./sherpa-onnx-zipformer-en-2023-04-01/joiner-epoch-99-avg-1.onnx \
  35 + --num-threads=2 \
  36 + --decoding-method=modified_beam_search \
  37 + --files ./sherpa-onnx-zipformer-en-2023-04-01/test_wavs/0.wav \
  38 + ./sherpa-onnx-zipformer-en-2023-04-01/test_wavs/1.wav
  39 +
  40 +# 0.wav: QUARTER -> QUARTERS
  41 +# 1.wav: FOR EVER -> FOREVER
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 2
  3 +set -ex
  4 +
3 if [ ! -d ./sherpa-onnx-nemo-ctc-en-conformer-medium ]; then 5 if [ ! -d ./sherpa-onnx-nemo-ctc-en-conformer-medium ]; then
4 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-nemo-ctc-en-conformer-medium 6 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-nemo-ctc-en-conformer-medium
5 cd sherpa-onnx-nemo-ctc-en-conformer-medium 7 cd sherpa-onnx-nemo-ctc-en-conformer-medium
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 2
  3 +set -ex
  4 +
3 if [ ! -d ./sherpa-onnx-paraformer-zh-2023-03-28 ]; then 5 if [ ! -d ./sherpa-onnx-paraformer-zh-2023-03-28 ]; then
4 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28 6 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28
5 cd sherpa-onnx-paraformer-zh-2023-03-28 7 cd sherpa-onnx-paraformer-zh-2023-03-28
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 2
  3 +set -ex
  4 +
3 if [ ! -d ./sherpa-onnx-tdnn-yesno ]; then 5 if [ ! -d ./sherpa-onnx-tdnn-yesno ]; then
4 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-tdnn-yesno 6 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-tdnn-yesno
5 cd sherpa-onnx-tdnn-yesno 7 cd sherpa-onnx-tdnn-yesno
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 2
  3 +set -ex
  4 +
3 if [ ! -d ./sherpa-onnx-whisper-tiny.en ]; then 5 if [ ! -d ./sherpa-onnx-whisper-tiny.en ]; then
4 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-whisper-tiny.en 6 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-whisper-tiny.en
5 cd sherpa-onnx-whisper-tiny.en 7 cd sherpa-onnx-whisper-tiny.en
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 -# 2 +
  3 +set -ex
  4 +
3 if [ ! -d ./sherpa-onnx-zipformer-en-2023-04-01 ]; then 5 if [ ! -d ./sherpa-onnx-zipformer-en-2023-04-01 ]; then
4 - GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-zipformer-en-2023-04-01  
5 - cd sherpa-onnx-zipformer-en-2023-04-01  
6 - git lfs pull --include "*.onnx"  
7 - cd .. 6 + wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
  7 + tar xvf sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
  8 + rm sherpa-onnx-zipformer-en-2023-04-01.tar.bz2
8 fi 9 fi
9 10
10 dotnet run \ 11 dotnet run \
  1 +#!/usr/bin/env bash
  2 +
  3 +set -ex
  4 +if [ ! -f ./vits-piper-en_US-amy-low/en_US-amy-low.onnx ]; then
  5 + # wget -qq https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-amy-low.tar.bz2
  6 + curl -OL https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-amy-low.tar.bz2
  7 + tar xf vits-piper-en_US-amy-low.tar.bz2
  8 + rm vits-piper-en_US-amy-low.tar.bz2
  9 +fi
  10 +
  11 +dotnet run \
  12 + --vits-model=./vits-piper-en_US-amy-low/en_US-amy-low.onnx \
  13 + --vits-tokens=./vits-piper-en_US-amy-low/tokens.txt \
  14 + --vits-data-dir=./vits-piper-en_US-amy-low/espeak-ng-data \
  15 + --debug=1 \
  16 + --output-filename=./amy.wav \
  17 + --text="This is a text to speech application in dotnet with Next Generation Kaldi"
  18 +
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 - 2 +set -ex
3 if [ ! -f ./vits-zh-aishell3/vits-aishell3.onnx ]; then 3 if [ ! -f ./vits-zh-aishell3/vits-aishell3.onnx ]; then
4 # wget -qq https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-zh-aishell3.tar.bz2 4 # wget -qq https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-zh-aishell3.tar.bz2
5 curl -OL https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-zh-aishell3.tar.bz2 5 curl -OL https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-zh-aishell3.tar.bz2
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 2
  3 +set -ex
3 if [ ! -f ./vits-piper-en_US-amy-low/en_US-amy-low.onnx ]; then 4 if [ ! -f ./vits-piper-en_US-amy-low/en_US-amy-low.onnx ]; then
4 # wget -qq https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-amy-low.tar.bz2 5 # wget -qq https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-amy-low.tar.bz2
5 curl -OL https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-amy-low.tar.bz2 6 curl -OL https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-amy-low.tar.bz2
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 # https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-paraformer/paraformer-models.html#csukuangfj-sherpa-onnx-streaming-paraformer-bilingual-zh-en-chinese-english 4 # https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-paraformer/paraformer-models.html#csukuangfj-sherpa-onnx-streaming-paraformer-bilingual-zh-en-chinese-english
5 # to download the model files 5 # to download the model files
6 6
  7 +set -ex
7 if [ ! -d ./sherpa-onnx-streaming-paraformer-bilingual-zh-en ]; then 8 if [ ! -d ./sherpa-onnx-streaming-paraformer-bilingual-zh-en ]; then
8 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-paraformer-bilingual-zh-en 9 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-paraformer-bilingual-zh-en
9 cd sherpa-onnx-streaming-paraformer-bilingual-zh-en 10 cd sherpa-onnx-streaming-paraformer-bilingual-zh-en
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 # https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-transducer/zipformer-transducer-models.html#csukuangfj-sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20-bilingual-chinese-english 4 # https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-transducer/zipformer-transducer-models.html#csukuangfj-sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20-bilingual-chinese-english
5 # to download the model files 5 # to download the model files
6 6
  7 +set -ex
7 if [ ! -d ./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 ]; then 8 if [ ! -d ./sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 ]; then
8 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 9 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
9 cd sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 10 cd sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 # https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-ctc/zipformer-ctc-models.html#sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13-chinese 4 # https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-ctc/zipformer-ctc-models.html#sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13-chinese
5 # to download the model files 5 # to download the model files
6 6
  7 +set -ex
7 if [ ! -d ./sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13 ]; then 8 if [ ! -d ./sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13 ]; then
8 curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13.tar.bz2 9 curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13.tar.bz2
9 tar xvf sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13.tar.bz2 10 tar xvf sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13.tar.bz2
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 # https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-paraformer/paraformer-models.html#csukuangfj-sherpa-onnx-streaming-paraformer-bilingual-zh-en-chinese-english 4 # https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-paraformer/paraformer-models.html#csukuangfj-sherpa-onnx-streaming-paraformer-bilingual-zh-en-chinese-english
5 # to download the model files 5 # to download the model files
6 6
  7 +set -ex
7 if [ ! -d ./sherpa-onnx-streaming-paraformer-bilingual-zh-en ]; then 8 if [ ! -d ./sherpa-onnx-streaming-paraformer-bilingual-zh-en ]; then
8 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-paraformer-bilingual-zh-en 9 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-paraformer-bilingual-zh-en
9 cd sherpa-onnx-streaming-paraformer-bilingual-zh-en 10 cd sherpa-onnx-streaming-paraformer-bilingual-zh-en
@@ -4,6 +4,8 @@ @@ -4,6 +4,8 @@
4 # https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-transducer/zipformer-transducer-models.html#csukuangfj-sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20-bilingual-chinese-english 4 # https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-transducer/zipformer-transducer-models.html#csukuangfj-sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20-bilingual-chinese-english
5 # to download the model files 5 # to download the model files
6 # 6 #
  7 +set -ex
  8 +
7 export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH 9 export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH
8 export DYLD_LIBRARY_PATH=$PWD:$DYLD_LIBRARY_PATH 10 export DYLD_LIBRARY_PATH=$PWD:$DYLD_LIBRARY_PATH
9 11