diff --git a/.github/scripts/test-offline-tts.sh b/.github/scripts/test-offline-tts.sh index 15581eaac8..f063ca0d58 100755 --- a/.github/scripts/test-offline-tts.sh +++ b/.github/scripts/test-offline-tts.sh @@ -44,24 +44,24 @@ done rm -rf kokoro-en-v0_19 log "------------------------------------------------------------" -log "matcha-tts-fa_en-male" +log "matcha-tts-fa_en-musa" log "------------------------------------------------------------" -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/matcha-tts-fa_en-male.tar.bz2 -tar xvf matcha-tts-fa_en-male.tar.bz2 -rm matcha-tts-fa_en-male.tar.bz2 +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/matcha-tts-fa_en-musa.tar.bz2 +tar xvf matcha-tts-fa_en-musa.tar.bz2 +rm matcha-tts-fa_en-musa.tar.bz2 curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/vocoder-models/hifigan_v2.onnx $EXE \ - --matcha-acoustic-model=./matcha-tts-fa_en-male/model.onnx \ + --matcha-acoustic-model=./matcha-tts-fa_en-musa/model.onnx \ --matcha-vocoder=./hifigan_v2.onnx \ - --matcha-tokens=./matcha-tts-fa_en-male/tokens.txt \ - --matcha-data-dir=./matcha-tts-fa_en-male/espeak-ng-data \ - --output-filename=./tts/test-matcha-fa-en-male.wav \ + --matcha-tokens=./matcha-tts-fa_en-musa/tokens.txt \ + --matcha-data-dir=./matcha-tts-fa_en-musa/espeak-ng-data \ + --output-filename=./tts/test-matcha-fa-en-musa.wav \ --num-threads=2 \ "How are you doing today? این یک نمونه ی تست فارسی است. This is a test." -rm -rf matcha-tts-fa_en-male +rm -rf matcha-tts-fa_en-musa rm hifigan_v2.onnx ls -lh tts/*.wav diff --git a/.github/workflows/windows-x64.yaml b/.github/workflows/windows-x64.yaml index 76dd426238..6cf9f579be 100644 --- a/.github/workflows/windows-x64.yaml +++ b/.github/workflows/windows-x64.yaml @@ -91,6 +91,83 @@ jobs: name: release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }} path: build/install/* + - name: Copy files + shell: bash + run: | + SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) + + shared_lib=${{ matrix.shared_lib }} + if [[ $shared_lib == "ON" ]]; then + suffix=shared + else + suffix=static + fi + + if [[ ${{ matrix.with_tts }} == ON ]]; then + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-$suffix + else + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-$suffix-no-tts + fi + + mkdir $dst + + cp -a build/install/bin $dst/ + cp -a build/install/lib $dst/ + cp -a build/install/include $dst/ + + 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') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') + 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 + export GIT_CLONE_PROTECTION_ACTIVE=false + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface + + cd huggingface + 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.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 + repo_name: k2-fsa/sherpa-onnx + repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }} + tag: v1.10.45 + + - name: Release pre-compiled binaries and libs for Windows x64 + if: 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 + - name: Test offline Moonshine for windows x64 shell: bash run: | @@ -224,69 +301,3 @@ jobs: export EXE=decode-file-c-api.exe .github/scripts/test-online-transducer.sh - - - name: Copy files - shell: bash - run: | - SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) - - shared_lib=${{ matrix.shared_lib }} - if [[ $shared_lib == "ON" ]]; then - suffix=shared - else - suffix=static - fi - - if [[ ${{ matrix.with_tts }} ]]; then - dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-$suffix - else - dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-$suffix-no-tts - fi - - mkdir $dst - - cp -a build/install/bin $dst/ - cp -a build/install/lib $dst/ - cp -a build/install/include $dst/ - - 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') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') - 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 - export GIT_CLONE_PROTECTION_ACTIVE=false - GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface - - cd huggingface - 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 diff --git a/.github/workflows/windows-x86.yaml b/.github/workflows/windows-x86.yaml index f1498c0c0c..b69c824466 100644 --- a/.github/workflows/windows-x86.yaml +++ b/.github/workflows/windows-x86.yaml @@ -91,6 +91,86 @@ jobs: name: release-windows-x86-${{ matrix.shared_lib }}-${{ matrix.with_tts }} path: build/install/* + - name: Copy files + 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 + suffix=shared + else + suffix=static + fi + + if [[ ${{ matrix.with_tts }} == ON ]]; then + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-$suffix + else + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-$suffix-no-tts + fi + + mkdir $dst + + cp -a build/install/bin $dst/ + cp -a build/install/lib $dst/ + cp -a build/install/include $dst/ + + 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') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') + 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 + export GIT_CLONE_PROTECTION_ACTIVE=false + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface + + cd huggingface + 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.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 + repo_name: k2-fsa/sherpa-onnx + repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }} + tag: v1.10.45 + + - name: Release pre-compiled binaries and libs for Windows x86 + if: 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 + - name: Test offline Moonshine for windows x86 shell: bash run: | @@ -223,72 +303,3 @@ jobs: export EXE=decode-file-c-api.exe .github/scripts/test-online-transducer.sh - - - name: Copy files - 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 - suffix=shared - else - suffix=static - fi - - if [[ ${{ matrix.with_tts }} ]]; then - dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-$suffix - else - dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-$suffix-no-tts - fi - - mkdir $dst - - cp -a build/install/bin $dst/ - cp -a build/install/lib $dst/ - cp -a build/install/include $dst/ - - 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') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') - 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 - export GIT_CLONE_PROTECTION_ACTIVE=false - GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface - - cd huggingface - 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 diff --git a/sherpa-onnx/csrc/offline-whisper-greedy-search-decoder.cc b/sherpa-onnx/csrc/offline-whisper-greedy-search-decoder.cc index 6ff165a22f..f94cc4cf36 100644 --- a/sherpa-onnx/csrc/offline-whisper-greedy-search-decoder.cc +++ b/sherpa-onnx/csrc/offline-whisper-greedy-search-decoder.cc @@ -124,6 +124,9 @@ OfflineWhisperGreedySearchDecoder::Decode(Ort::Value cross_k, std::get<5>(decoder_out).GetTensorMutableData(); *p_offset += 1; + if (*p_offset >= n_text_ctx - 1) { + break; + } const auto &logits = std::get<0>(decoder_out); const float *p_logits = logits.GetTensorData();