diff --git a/.github/workflows/test-go-package.yaml b/.github/workflows/test-go-package.yaml index f76157ab..79cf17e4 100644 --- a/.github/workflows/test-go-package.yaml +++ b/.github/workflows/test-go-package.yaml @@ -149,27 +149,19 @@ jobs: go build ls -lh - git lfs install - echo "Test vits-ljs" - git clone https://huggingface.co/csukuangfj/vits-ljs ./run-vits-ljs.sh rm -rf vits-ljs echo "Test vits-vctk" - git clone https://huggingface.co/csukuangfj/vits-vctk ./run-vits-vctk.sh rm -rf vits-vctk echo "Test vits-icefall-zh-aishell3" - curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-icefall-zh-aishell3.tar.bz2 - tar xvf vits-icefall-zh-aishell3.tar.bz2 - rm vits-icefall-zh-aishell3.tar.bz2 ./run-vits-zh-aishell3.sh - rm -rf vits-icefall-zh-aishell3* + rm -rf vits-icefall-zh-aishell3 echo "Test vits-piper-en_US-lessac-medium" - git clone https://huggingface.co/csukuangfj/vits-piper-en_US-lessac-medium ./run-vits-piper-en_US-lessac-medium.sh rm -rf vits-piper-en_US-lessac-medium @@ -194,25 +186,19 @@ jobs: cp -v /C/Users/runneradmin/go/pkg/mod/github.com/k2-fsa/sherpa-onnx-go-windows*/lib/x86_64-pc-windows-gnu/*.dll . ls -lh - git lfs install - echo "Test vits-ljs" - git clone https://huggingface.co/csukuangfj/vits-ljs ./run-vits-ljs.sh rm -rf vits-ljs echo "Test vits-vctk" - git clone https://huggingface.co/csukuangfj/vits-vctk ./run-vits-vctk.sh rm -rf vits-vctk echo "Test vits-zh-aishell3" - git clone https://huggingface.co/csukuangfj/vits-zh-aishell3 ./run-vits-zh-aishell3.sh - rm -rf vits-zh-aishell3 + rm -rf vits-icefall-zh-aishell3 echo "Test vits-piper-en_US-lessac-medium" - git clone https://huggingface.co/csukuangfj/vits-piper-en_US-lessac-medium ./run-vits-piper-en_US-lessac-medium.sh rm -rf vits-piper-en_US-lessac-medium @@ -245,25 +231,19 @@ jobs: cp -v /C/Users/runneradmin/go/pkg/mod/github.com/k2-fsa/sherpa-onnx-go-windows*/lib/i686-pc-windows-gnu/*.dll . ls -lh - git lfs install - echo "Test vits-ljs" - git clone https://huggingface.co/csukuangfj/vits-ljs ./run-vits-ljs.sh rm -rf vits-ljs echo "Test vits-vctk" - git clone https://huggingface.co/csukuangfj/vits-vctk ./run-vits-vctk.sh rm -rf vits-vctk echo "Test vits-zh-aishell3" - git clone https://huggingface.co/csukuangfj/vits-zh-aishell3 ./run-vits-zh-aishell3.sh rm -rf vits-zh-aishell3 echo "Test vits-piper-en_US-lessac-medium" - git clone https://huggingface.co/csukuangfj/vits-piper-en_US-lessac-medium ./run-vits-piper-en_US-lessac-medium.sh rm -rf vits-piper-en_US-lessac-medium @@ -281,33 +261,23 @@ jobs: go build ls -lh - git lfs install - echo "Test transducer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-zipformer-en-2023-06-26 ./run-transducer.sh rm -rf sherpa-onnx-zipformer-en-2023-06-26 echo "Test paraformer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28 ./run-paraformer.sh rm -rf sherpa-onnx-paraformer-zh-2023-03-28 echo "Test NeMo CTC" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-nemo-ctc-en-conformer-medium ./run-nemo-ctc.sh rm -rf sherpa-onnx-nemo-ctc-en-conformer-medium echo "Test Whisper tiny.en" - GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-whisper-tiny.en - cd sherpa-onnx-whisper-tiny.en - git lfs pull --include "*.onnx" - cd .. ./run-whisper.sh rm -rf sherpa-onnx-whisper-tiny.en echo "Test Tdnn yesno" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-tdnn-yesno ./run-tdnn-yesno.sh rm -rf sherpa-onnx-tdnn-yesno @@ -328,33 +298,23 @@ jobs: cp -v /C/Users/runneradmin/go/pkg/mod/github.com/k2-fsa/sherpa-onnx-go-windows*/lib/x86_64-pc-windows-gnu/*.dll . ls -lh - git lfs install - echo "Test transducer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-zipformer-en-2023-06-26 ./run-transducer.sh rm -rf sherpa-onnx-zipformer-en-2023-06-26 echo "Test paraformer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28 ./run-paraformer.sh rm -rf sherpa-onnx-paraformer-zh-2023-03-28 echo "Test NeMo CTC" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-nemo-ctc-en-conformer-medium ./run-nemo-ctc.sh rm -rf sherpa-onnx-nemo-ctc-en-conformer-medium echo "Test Whisper tiny.en" - GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-whisper-tiny.en - cd sherpa-onnx-whisper-tiny.en - git lfs pull --include "*.onnx" - cd .. ./run-whisper.sh rm -rf sherpa-onnx-whisper-tiny.en echo "Test Tdnn yesno" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-tdnn-yesno ./run-tdnn-yesno.sh rm -rf sherpa-onnx-tdnn-yesno @@ -383,33 +343,23 @@ jobs: cp -v /C/Users/runneradmin/go/pkg/mod/github.com/k2-fsa/sherpa-onnx-go-windows*/lib/i686-pc-windows-gnu/*.dll . ls -lh - git lfs install - echo "Test transducer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-zipformer-en-2023-06-26 ./run-transducer.sh rm -rf sherpa-onnx-zipformer-en-2023-06-26 echo "Test paraformer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28 ./run-paraformer.sh rm -rf sherpa-onnx-paraformer-zh-2023-03-28 echo "Test NeMo CTC" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-nemo-ctc-en-conformer-medium ./run-nemo-ctc.sh rm -rf sherpa-onnx-nemo-ctc-en-conformer-medium echo "Test Whisper tiny.en" - GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-whisper-tiny.en - cd sherpa-onnx-whisper-tiny.en - git lfs pull --include "*.onnx" - cd .. ./run-whisper.sh rm -rf sherpa-onnx-whisper-tiny.en echo "Test Tdnn yesno" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-tdnn-yesno ./run-tdnn-yesno.sh rm -rf sherpa-onnx-tdnn-yesno @@ -424,15 +374,11 @@ jobs: go build ls -lh - git lfs install - echo "Test transducer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-en-2023-06-26 ./run-transducer.sh rm -rf sherpa-onnx-streaming-zipformer-en-2023-06-26 echo "Test paraformer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-paraformer-bilingual-zh-en ./run-paraformer.sh rm -rf sherpa-onnx-streaming-paraformer-bilingual-zh-en @@ -453,15 +399,11 @@ jobs: cp -v /C/Users/runneradmin/go/pkg/mod/github.com/k2-fsa/sherpa-onnx-go-windows*/lib/x86_64-pc-windows-gnu/*.dll . ls -lh - git lfs install - echo "Test transducer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-en-2023-06-26 ./run-transducer.sh rm -rf sherpa-onnx-streaming-zipformer-en-2023-06-26 echo "Test paraformer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-paraformer-bilingual-zh-en ./run-paraformer.sh rm -rf sherpa-onnx-streaming-paraformer-bilingual-zh-en @@ -491,15 +433,11 @@ jobs: cp -v /C/Users/runneradmin/go/pkg/mod/github.com/k2-fsa/sherpa-onnx-go-windows*/lib/i686-pc-windows-gnu/*.dll . ls -lh - git lfs install - echo "Test transducer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-en-2023-06-26 ./run-transducer.sh rm -rf sherpa-onnx-streaming-zipformer-en-2023-06-26 echo "Test paraformer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-paraformer-bilingual-zh-en ./run-paraformer.sh rm -rf sherpa-onnx-streaming-paraformer-bilingual-zh-en diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index e7bf9cfd..fa88d794 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -59,6 +59,12 @@ jobs: go version go env GOPATH go env GOARCH + go env CGO_ENABLED + + - name: Display go env + shell: bash + run: | + go env - name: Build sherpa-onnx shell: bash @@ -71,21 +77,26 @@ jobs: cp -v _deps/onnxruntime-src/lib/libonnxruntime*dylib ./lib/ cd ../scripts/go/_internal/ + ls -lh lib + echo "-----" + ls -lh lib/*/ + echo "-----" + go mod tidy go build - - name: Test streaming HLG decoding - shell: bash - run: | - cd scripts/go/_internal/streaming-hlg-decoding/ - ./run.sh - - name: Test speaker identification shell: bash run: | cd scripts/go/_internal/speaker-identification/ ./run.sh + - name: Test streaming HLG decoding + shell: bash + run: | + cd scripts/go/_internal/streaming-hlg-decoding/ + ./run.sh + - name: Test non-streaming TTS (macOS) shell: bash run: | @@ -101,24 +112,18 @@ jobs: git lfs install echo "Test vits-ljs" - git clone https://huggingface.co/csukuangfj/vits-ljs ./run-vits-ljs.sh rm -rf vits-ljs echo "Test vits-vctk" - git clone https://huggingface.co/csukuangfj/vits-vctk ./run-vits-vctk.sh rm -rf vits-vctk echo "Test vits-zh-aishell3" - curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-icefall-zh-aishell3.tar.bz2 - tar xvf vits-icefall-zh-aishell3.tar.bz2 - rm vits-icefall-zh-aishell3.tar.bz2 ./run-vits-zh-aishell3.sh rm -rf vits-icefall-zh-aishell3 echo "Test vits-piper-en_US-lessac-medium" - git clone https://huggingface.co/csukuangfj/vits-piper-en_US-lessac-medium ./run-vits-piper-en_US-lessac-medium.sh rm -rf vits-piper-en_US-lessac-medium @@ -142,30 +147,22 @@ jobs: git lfs install echo "Test transducer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-zipformer-en-2023-06-26 ./run-transducer.sh rm -rf sherpa-onnx-zipformer-en-2023-06-26 echo "Test paraformer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28 ./run-paraformer.sh rm -rf sherpa-onnx-paraformer-zh-2023-03-28 echo "Test NeMo CTC" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-nemo-ctc-en-conformer-medium ./run-nemo-ctc.sh rm -rf sherpa-onnx-nemo-ctc-en-conformer-medium echo "Test Whisper tiny.en" - GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-whisper-tiny.en - cd sherpa-onnx-whisper-tiny.en - git lfs pull --include "*.onnx" - cd .. ./run-whisper.sh rm -rf sherpa-onnx-whisper-tiny.en echo "Test Tdnn yesno" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-tdnn-yesno ./run-tdnn-yesno.sh rm -rf sherpa-onnx-tdnn-yesno @@ -179,22 +176,14 @@ jobs: go build ls -lh - git lfs install - echo "Test zipformer2 CTC" - 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 - ./run-zipformer2-ctc.sh rm -rf sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13 echo "Test transducer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-en-2023-06-26 ./run-transducer.sh rm -rf sherpa-onnx-streaming-zipformer-en-2023-06-26 echo "Test paraformer" - git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-paraformer-bilingual-zh-en ./run-paraformer.sh rm -rf sherpa-onnx-streaming-paraformer-bilingual-zh-en diff --git a/go-api-examples/non-streaming-decode-files/main.go b/go-api-examples/non-streaming-decode-files/main.go index d4f076c5..d38c43c2 100644 --- a/go-api-examples/non-streaming-decode-files/main.go +++ b/go-api-examples/non-streaming-decode-files/main.go @@ -31,6 +31,7 @@ func main() { flag.StringVar(&config.ModelConfig.Whisper.Decoder, "whisper-decoder", "", "Path to the whisper decoder model") flag.StringVar(&config.ModelConfig.Whisper.Language, "whisper-language", "", "Language of the input wave. You can leave it empty ") flag.StringVar(&config.ModelConfig.Whisper.Task, "whisper-task", "transcribe", "transcribe or translate") + flag.IntVar(&config.ModelConfig.Whisper.TailPaddings, "whisper-tail-paddings", -1, "tail paddings for whisper") flag.StringVar(&config.ModelConfig.Tdnn.Model, "tdnn-model", "", "Path to the tdnn model") diff --git a/go-api-examples/non-streaming-decode-files/run-nemo-ctc.sh b/go-api-examples/non-streaming-decode-files/run-nemo-ctc.sh index 8655e5b6..09255c6c 100755 --- a/go-api-examples/non-streaming-decode-files/run-nemo-ctc.sh +++ b/go-api-examples/non-streaming-decode-files/run-nemo-ctc.sh @@ -1,11 +1,15 @@ #!/usr/bin/env bash -# Please refer to -# https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-ctc/nemo/english.html#stt-en-conformer-ctc-medium -# to download the model -# before you run this script. -# -# You can switch to a different offline model if you need +set -ex + +if [ ! -d sherpa-onnx-nemo-ctc-en-conformer-medium ]; then + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-nemo-ctc-en-conformer-medium.tar.bz2 + tar xvf sherpa-onnx-nemo-ctc-en-conformer-medium.tar.bz2 + rm sherpa-onnx-nemo-ctc-en-conformer-medium.tar.bz2 +fi + +go mod tidy +go build ./non-streaming-decode-files \ --nemo-ctc ./sherpa-onnx-nemo-ctc-en-conformer-medium/model.onnx \ diff --git a/go-api-examples/non-streaming-decode-files/run-paraformer.sh b/go-api-examples/non-streaming-decode-files/run-paraformer.sh index 191a6a41..ae52ab18 100755 --- a/go-api-examples/non-streaming-decode-files/run-paraformer.sh +++ b/go-api-examples/non-streaming-decode-files/run-paraformer.sh @@ -1,10 +1,15 @@ #!/usr/bin/env bash -# Please refer to -# https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-paraformer/paraformer-models.html#csukuangfj-sherpa-onnx-paraformer-zh-2023-03-28-chinese -# to download the model -# before you run this script. -# +set -ex + +if [ ! -d sherpa-onnx-paraformer-zh-2023-03-28 ]; then + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2 + tar xvf sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2 + rm sherpa-onnx-paraformer-zh-2023-03-28.tar.bz2 +fi + +go mod tidy +go build ./non-streaming-decode-files \ --paraformer ./sherpa-onnx-paraformer-zh-2023-03-28/model.int8.onnx \ diff --git a/go-api-examples/non-streaming-decode-files/run-tdnn-yesno.sh b/go-api-examples/non-streaming-decode-files/run-tdnn-yesno.sh index 4253a362..a4998436 100755 --- a/go-api-examples/non-streaming-decode-files/run-tdnn-yesno.sh +++ b/go-api-examples/non-streaming-decode-files/run-tdnn-yesno.sh @@ -1,10 +1,15 @@ #!/usr/bin/env bash -# Please refer to -# https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-ctc/yesno/index.html -# to download the model -# before you run this script. -# +set -ex + +if [ ! -d sherpa-onnx-tdnn-yesno ]; then + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-tdnn-yesno.tar.bz2 + tar xvf sherpa-onnx-tdnn-yesno.tar.bz2 + rm sherpa-onnx-tdnn-yesno.tar.bz2 +fi + +go mod tidy +go build ./non-streaming-decode-files \ --sample-rate=8000 \ diff --git a/go-api-examples/non-streaming-decode-files/run-transducer.sh b/go-api-examples/non-streaming-decode-files/run-transducer.sh index cec6c84f..cc12a422 100755 --- a/go-api-examples/non-streaming-decode-files/run-transducer.sh +++ b/go-api-examples/non-streaming-decode-files/run-transducer.sh @@ -1,11 +1,15 @@ #!/usr/bin/env bash -# Please refer to -# https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-transducer/zipformer-transducer-models.html#csukuangfj-sherpa-onnx-zipformer-en-2023-06-26-english -# to download the model -# before you run this script. -# -# You can switch to a different offline model if you need +set -ex + +if [ ! -d sherpa-onnx-streaming-zipformer-en-2023-06-26 ]; then + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-zipformer-en-2023-06-26.tar.bz2 + tar xvf sherpa-onnx-zipformer-en-2023-06-26.tar.bz2 + rm sherpa-onnx-zipformer-en-2023-06-26.tar.bz2 +fi + +go mod tidy +go build ./non-streaming-decode-files \ --encoder ./sherpa-onnx-zipformer-en-2023-06-26/encoder-epoch-99-avg-1.onnx \ diff --git a/go-api-examples/non-streaming-decode-files/run-whisper.sh b/go-api-examples/non-streaming-decode-files/run-whisper.sh index cf723418..66754edf 100755 --- a/go-api-examples/non-streaming-decode-files/run-whisper.sh +++ b/go-api-examples/non-streaming-decode-files/run-whisper.sh @@ -1,11 +1,15 @@ #!/usr/bin/env bash -# Please refer to -# https://k2-fsa.github.io/sherpa/onnx/pretrained_models/whisper/tiny.en.html -# to download the model -# before you run this script. -# -# You can switch to a different offline model if you need +set -ex + +if [ ! -d sherpa-onnx-whisper-tiny.en ]; then + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-whisper-tiny.en.tar.bz2 + tar xvf sherpa-onnx-whisper-tiny.en.tar.bz2 + rm sherpa-onnx-whisper-tiny.en.tar.bz2 +fi + +go mod tidy +go build ./non-streaming-decode-files \ --whisper-encoder=./sherpa-onnx-whisper-tiny.en/tiny.en-encoder.onnx \ diff --git a/go-api-examples/non-streaming-tts/run-vits-ljs.sh b/go-api-examples/non-streaming-tts/run-vits-ljs.sh index c0f2a7b1..e2738710 100755 --- a/go-api-examples/non-streaming-tts/run-vits-ljs.sh +++ b/go-api-examples/non-streaming-tts/run-vits-ljs.sh @@ -1,8 +1,15 @@ #!/usr/bin/env bash -# please refer to -# https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/vits.html#ljspeech-english-single-speaker -# to download the model before you run this script +set -ex + +if [ ! -d vits-ljs ]; then + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-ljs.tar.bz2 + tar xvf vits-ljs.tar.bz2 + rm vits-ljs.tar.bz2 +fi + +go mod tidy +go build ./non-streaming-tts \ --vits-model=./vits-ljs/vits-ljs.onnx \ diff --git a/go-api-examples/non-streaming-tts/run-vits-piper-en_US-lessac-medium.sh b/go-api-examples/non-streaming-tts/run-vits-piper-en_US-lessac-medium.sh index dee8e3d4..15e4f1db 100755 --- a/go-api-examples/non-streaming-tts/run-vits-piper-en_US-lessac-medium.sh +++ b/go-api-examples/non-streaming-tts/run-vits-piper-en_US-lessac-medium.sh @@ -1,8 +1,15 @@ #!/usr/bin/env bash -# please refer to -# https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/vits.html#en-us-lessac-medium-english-single-speaker -# to download the model before you run this script +set -ex + +if [ ! -d vits-piper-en_US-lessac-medium ]; then + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-lessac-medium.tar.bz2 + tar xvf vits-piper-en_US-lessac-medium.tar.bz2 + rm vits-piper-en_US-lessac-medium.tar.bz2 +fi + +go mod tidy +go build ./non-streaming-tts \ --vits-model=./vits-piper-en_US-lessac-medium/en_US-lessac-medium.onnx \ diff --git a/go-api-examples/non-streaming-tts/run-vits-vctk.sh b/go-api-examples/non-streaming-tts/run-vits-vctk.sh index ceaf6043..566b2119 100755 --- a/go-api-examples/non-streaming-tts/run-vits-vctk.sh +++ b/go-api-examples/non-streaming-tts/run-vits-vctk.sh @@ -1,8 +1,15 @@ #!/usr/bin/env bash -# please refer to -# https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/vits.html#vctk-english-multi-speaker-109-speakers -# to download the model before you run this script +set -ex + +if [ ! -d vits-vctk ]; then + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-vctk.tar.bz2 + tar xvf vits-vctk.tar.bz2 + rm vits-vctk.tar.bz2 +fi + +go mod tidy +go build for sid in 0 10 108; do ./non-streaming-tts \ diff --git a/go-api-examples/non-streaming-tts/run-vits-zh-aishell3.sh b/go-api-examples/non-streaming-tts/run-vits-zh-aishell3.sh index 2ab0c613..41790ca0 100755 --- a/go-api-examples/non-streaming-tts/run-vits-zh-aishell3.sh +++ b/go-api-examples/non-streaming-tts/run-vits-zh-aishell3.sh @@ -1,8 +1,14 @@ #!/usr/bin/env bash +set -ex -# please refer to -# https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/vits.html#aishell3-chinese-multi-speaker-174-speakers -# to download the model before you run this script +if [ ! -d vits-icefall-zh-aishell3 ]; then + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-icefall-zh-aishell3.tar.bz2 + tar xvf vits-icefall-zh-aishell3.tar.bz2 + rm vits-icefall-zh-aishell3.tar.bz2 +fi + +go mod tidy +go build for sid in 10 33 99; do ./non-streaming-tts \ diff --git a/go-api-examples/real-time-speech-recognition-from-microphone/run.sh b/go-api-examples/real-time-speech-recognition-from-microphone/run.sh index 479e57d8..8b007746 100755 --- a/go-api-examples/real-time-speech-recognition-from-microphone/run.sh +++ b/go-api-examples/real-time-speech-recognition-from-microphone/run.sh @@ -1,11 +1,15 @@ #!/usr/bin/env bash -# Please refer to -# https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-transducer/zipformer-transducer-models.html#pkufool-icefall-asr-zipformer-streaming-wenetspeech-20230615-chinese -# to download the model -# before you run this script. -# -# You can switch to different online models if you need +set -ex + +if [ ! -d icefall-asr-zipformer-streaming-wenetspeech-20230615 ]; then + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/icefall-asr-zipformer-streaming-wenetspeech-20230615.tar.bz2 + tar xvf icefall-asr-zipformer-streaming-wenetspeech-20230615.tar.bz2 + rm icefall-asr-zipformer-streaming-wenetspeech-20230615.tar.bz2 +fi + +go mod tidy +go build ./real-time-speech-recognition-from-microphone \ --encoder ./icefall-asr-zipformer-streaming-wenetspeech-20230615/exp/encoder-epoch-12-avg-4-chunk-16-left-128.onnx \ diff --git a/go-api-examples/speaker-identification/run.sh b/go-api-examples/speaker-identification/run.sh index 3829eee9..15b3c09b 100755 --- a/go-api-examples/speaker-identification/run.sh +++ b/go-api-examples/speaker-identification/run.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -ex + if [ ! -f ./3dspeaker_speech_campplus_sv_zh-cn_16k-common.onnx ]; then curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/3dspeaker_speech_campplus_sv_zh-cn_16k-common.onnx fi diff --git a/go-api-examples/streaming-decode-files/run-paraformer.sh b/go-api-examples/streaming-decode-files/run-paraformer.sh index f2b7fbf2..90ff3f64 100755 --- a/go-api-examples/streaming-decode-files/run-paraformer.sh +++ b/go-api-examples/streaming-decode-files/run-paraformer.sh @@ -1,16 +1,16 @@ #!/usr/bin/env bash -# Please refer to -# https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-paraformer/paraformer-models.html#csukuangfj-sherpa-onnx-streaming-paraformer-bilingual-zh-en-chinese-english -# to download the model files +set -ex if [ ! -d ./sherpa-onnx-streaming-paraformer-bilingual-zh-en ]; then - GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-streaming-paraformer-bilingual-zh-en - cd sherpa-onnx-streaming-paraformer-bilingual-zh-en - git lfs pull --include "*.onnx" - cd .. + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-paraformer-bilingual-zh-en.tar.bz2 + tar xvf sherpa-onnx-streaming-paraformer-bilingual-zh-en.tar.bz2 + rm sherpa-onnx-streaming-paraformer-bilingual-zh-en.tar.bz2 fi +go mod tidy +go build + ./streaming-decode-files \ --paraformer-encoder ./sherpa-onnx-streaming-paraformer-bilingual-zh-en/encoder.int8.onnx \ --paraformer-decoder ./sherpa-onnx-streaming-paraformer-bilingual-zh-en/decoder.int8.onnx \ diff --git a/go-api-examples/streaming-decode-files/run-transducer.sh b/go-api-examples/streaming-decode-files/run-transducer.sh index 461aff1c..69732f1c 100755 --- a/go-api-examples/streaming-decode-files/run-transducer.sh +++ b/go-api-examples/streaming-decode-files/run-transducer.sh @@ -1,11 +1,15 @@ #!/usr/bin/env bash -# Please refer to -# https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-transducer/zipformer-transducer-models.html#csukuangfj-sherpa-onnx-streaming-zipformer-en-2023-06-26-english -# to download the model -# before you run this script. -# -# You can switch to a different online model if you need +set -ex + +if [ ! -d sherpa-onnx-streaming-zipformer-en-2023-06-26 ]; then + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-en-2023-06-26.tar.bz2 + tar xvf sherpa-onnx-streaming-zipformer-en-2023-06-26.tar.bz2 + rm sherpa-onnx-streaming-zipformer-en-2023-06-26.tar.bz2 +fi + +go mod tidy +go build ./streaming-decode-files \ --encoder ./sherpa-onnx-streaming-zipformer-en-2023-06-26/encoder-epoch-99-avg-1-chunk-16-left-128.onnx \ diff --git a/go-api-examples/streaming-decode-files/run-zipformer2-ctc.sh b/go-api-examples/streaming-decode-files/run-zipformer2-ctc.sh index 4b145439..086f1dad 100755 --- a/go-api-examples/streaming-decode-files/run-zipformer2-ctc.sh +++ b/go-api-examples/streaming-decode-files/run-zipformer2-ctc.sh @@ -1,11 +1,15 @@ #!/usr/bin/env bash -# Please refer to -# 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 -# to download the model -# before you run this script. -# -# You can switch to a different online model if you need +set -ex + +if [ ! -d sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13 ]; then + 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 + 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 +fi + +go mod tidy +go build ./streaming-decode-files \ --zipformer2-ctc ./sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13/ctc-epoch-20-avg-1-chunk-16-left-128.onnx \ diff --git a/go-api-examples/vad-asr-paraformer/run.sh b/go-api-examples/vad-asr-paraformer/run.sh index 9d136804..17773f29 100755 --- a/go-api-examples/vad-asr-paraformer/run.sh +++ b/go-api-examples/vad-asr-paraformer/run.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash +set -ex if [ ! -f ./silero_vad.onnx ]; then curl -SL -O https://github.com/snakers4/silero-vad/raw/master/files/silero_vad.onnx diff --git a/go-api-examples/vad-asr-whisper/run.sh b/go-api-examples/vad-asr-whisper/run.sh index 8064887d..0c4c2f20 100755 --- a/go-api-examples/vad-asr-whisper/run.sh +++ b/go-api-examples/vad-asr-whisper/run.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash +set -ex if [ ! -f ./silero_vad.onnx ]; then curl -SL -O https://github.com/snakers4/silero-vad/raw/master/files/silero_vad.onnx diff --git a/go-api-examples/vad-speaker-identification/run.sh b/go-api-examples/vad-speaker-identification/run.sh index 1df02678..e90c31e3 100755 --- a/go-api-examples/vad-speaker-identification/run.sh +++ b/go-api-examples/vad-speaker-identification/run.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -ex + if [ ! -f ./3dspeaker_speech_campplus_sv_zh-cn_16k-common.onnx ]; then curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/3dspeaker_speech_campplus_sv_zh-cn_16k-common.onnx fi diff --git a/go-api-examples/vad-spoken-language-identification/run.sh b/go-api-examples/vad-spoken-language-identification/run.sh index 43ae2525..a5d5b295 100755 --- a/go-api-examples/vad-spoken-language-identification/run.sh +++ b/go-api-examples/vad-spoken-language-identification/run.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash +set -ex if [ ! -f ./silero_vad.onnx ]; then curl -SL -O https://github.com/snakers4/silero-vad/raw/master/files/silero_vad.onnx diff --git a/go-api-examples/vad/run.sh b/go-api-examples/vad/run.sh index 13e505ce..58b6ead3 100755 --- a/go-api-examples/vad/run.sh +++ b/go-api-examples/vad/run.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash +set -ex if [ ! -f ./silero_vad.onnx ]; then curl -SL -O https://github.com/snakers4/silero-vad/raw/master/files/silero_vad.onnx diff --git a/scripts/go/_internal/build_darwin_arm64.go b/scripts/go/_internal/build_darwin_arm64.go new file mode 100644 index 00000000..7556d27b --- /dev/null +++ b/scripts/go/_internal/build_darwin_arm64.go @@ -0,0 +1,6 @@ +//go:build darwin && arm64 && !ios + +package sherpa_onnx + +// #cgo LDFLAGS: -L ${SRCDIR}/lib/aarch64-apple-darwin -lsherpa-onnx-c-api -lsherpa-onnx-core -lkaldi-native-fbank-core -lkaldi-decoder-core -lsherpa-onnx-kaldifst-core -lsherpa-onnx-fstfar -lsherpa-onnx-fst -lpiper_phonemize -lespeak-ng -lucd -lonnxruntime -Wl,-rpath,${SRCDIR}/lib/aarch64-apple-darwin +import "C" diff --git a/scripts/go/_internal/lib/aarch64-apple-darwin b/scripts/go/_internal/lib/aarch64-apple-darwin new file mode 120000 index 00000000..b21b8dfa --- /dev/null +++ b/scripts/go/_internal/lib/aarch64-apple-darwin @@ -0,0 +1 @@ +../../../../build/lib \ No newline at end of file diff --git a/scripts/go/_internal/non-streaming-decode-files/go.mod b/scripts/go/_internal/non-streaming-decode-files/go.mod index 84a9ec90..c4f7dc8f 100644 --- a/scripts/go/_internal/non-streaming-decode-files/go.mod +++ b/scripts/go/_internal/non-streaming-decode-files/go.mod @@ -3,9 +3,3 @@ module non-streaming-decode-files go 1.12 replace github.com/k2-fsa/sherpa-onnx-go/sherpa_onnx => ../ - -require ( - github.com/k2-fsa/sherpa-onnx-go/sherpa_onnx v0.0.0-00010101000000-000000000000 - github.com/spf13/pflag v1.0.5 - github.com/youpy/go-wav v0.3.2 -) diff --git a/scripts/go/_internal/real-time-speech-recognition-from-microphone/go.mod b/scripts/go/_internal/real-time-speech-recognition-from-microphone/go.mod index 216ac21c..e6b64f3c 100644 --- a/scripts/go/_internal/real-time-speech-recognition-from-microphone/go.mod +++ b/scripts/go/_internal/real-time-speech-recognition-from-microphone/go.mod @@ -3,9 +3,3 @@ module real-time-speech-recognition-from-microphone go 1.12 replace github.com/k2-fsa/sherpa-onnx-go/sherpa_onnx => ../ - -require ( - github.com/gordonklaus/portaudio v0.0.0-20230709114228-aafa478834f5 - github.com/k2-fsa/sherpa-onnx-go/sherpa_onnx v0.0.0-00010101000000-000000000000 - github.com/spf13/pflag v1.0.5 -) diff --git a/scripts/go/_internal/streaming-decode-files/go.mod b/scripts/go/_internal/streaming-decode-files/go.mod index 30b590fa..34d87358 100644 --- a/scripts/go/_internal/streaming-decode-files/go.mod +++ b/scripts/go/_internal/streaming-decode-files/go.mod @@ -3,9 +3,3 @@ module streaming-decode-files go 1.12 replace github.com/k2-fsa/sherpa-onnx-go/sherpa_onnx => ../ - -require ( - github.com/k2-fsa/sherpa-onnx-go/sherpa_onnx v0.0.0-00010101000000-000000000000 - github.com/spf13/pflag v1.0.5 - github.com/youpy/go-wav v0.3.2 -)