diff --git a/.github/scripts/test-online-punctuation.sh b/.github/scripts/test-online-punctuation.sh new file mode 100755 index 00000000..1366aa25 --- /dev/null +++ b/.github/scripts/test-online-punctuation.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -ex + +log() { + # This function is from espnet + local fname=${BASH_SOURCE[1]##*/} + echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*" +} + +echo "EXE is $EXE" +echo "PATH: $PATH" + +which $EXE + +log "------------------------------------------------------------" +log "Download the punctuation model " +log "------------------------------------------------------------" + +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-online-punct-en-2024-08-06.tar.bz2 + +tar xvf sherpa-onnx-online-punct-en-2024-08-06.tar.bz2 +rm sherpa-onnx-online-punct-en-2024-08-06.tar.bz2 +repo=sherpa-onnx-online-punct-en-2024-08-06 +ls -lh $repo + +for m in model.onnx model.int8.onnx; do + $EXE \ + --debug=1 \ + --cnn-bilstm=$repo/$m \ + --bpe-vocab=$repo/bpe.vocab \ + "How are you i am fine thank you" + + $EXE \ + --debug=1 \ + --cnn-bilstm=$repo/$m \ + --bpe-vocab=$repo/bpe.vocab \ + "The African blogosphere is rapidly expanding bringing more voices online in the form of commentaries opinions analyses rants and poetry" +done + +rm -rf $repo diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 67fe9be7..1f983224 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -17,6 +17,7 @@ on: - '.github/scripts/test-offline-tts.sh' - '.github/scripts/test-audio-tagging.sh' - '.github/scripts/test-offline-punctuation.sh' + - '.github/scripts/test-online-punctuation.sh' - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' @@ -36,6 +37,7 @@ on: - '.github/scripts/test-offline-tts.sh' - '.github/scripts/test-audio-tagging.sh' - '.github/scripts/test-offline-punctuation.sh' + - '.github/scripts/test-online-punctuation.sh' - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' @@ -141,6 +143,16 @@ jobs: name: release-${{ matrix.build_type }}-with-shared-lib-${{ matrix.shared_lib }}-with-tts-${{ matrix.with_tts }} path: install/* + - name: Test online punctuation + shell: bash + run: | + du -h -d1 . + export PATH=$PWD/build/bin:$PATH + export EXE=sherpa-onnx-online-punctuation + + .github/scripts/test-online-punctuation.sh + du -h -d1 . + - name: Test offline transducer shell: bash run: | diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index e8c27110..1677d69f 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -17,6 +17,7 @@ on: - '.github/scripts/test-online-ctc.sh' - '.github/scripts/test-audio-tagging.sh' - '.github/scripts/test-offline-punctuation.sh' + - '.github/scripts/test-online-punctuation.sh' - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' @@ -35,6 +36,7 @@ on: - '.github/scripts/test-online-ctc.sh' - '.github/scripts/test-audio-tagging.sh' - '.github/scripts/test-offline-punctuation.sh' + - '.github/scripts/test-online-punctuation.sh' - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' @@ -113,6 +115,14 @@ jobs: otool -L build/bin/sherpa-onnx otool -l build/bin/sherpa-onnx + - name: Test online punctuation + shell: bash + run: | + export PATH=$PWD/build/bin:$PATH + export EXE=sherpa-onnx-online-punctuation + + .github/scripts/test-online-punctuation.sh + - name: Test offline transducer shell: bash run: | diff --git a/.github/workflows/sanitizer.yaml b/.github/workflows/sanitizer.yaml index 2d4abf49..7fce3834 100644 --- a/.github/workflows/sanitizer.yaml +++ b/.github/workflows/sanitizer.yaml @@ -76,6 +76,14 @@ jobs: otool -L build/bin/sherpa-onnx otool -l build/bin/sherpa-onnx + - name: Test online punctuation + shell: bash + run: | + export PATH=$PWD/build/bin:$PATH + export EXE=sherpa-onnx-online-punctuation + + .github/scripts/test-online-punctuation.sh + - name: Test offline punctuation shell: bash run: | diff --git a/.github/workflows/windows-x64.yaml b/.github/workflows/windows-x64.yaml index a80b0f69..2d2811c3 100644 --- a/.github/workflows/windows-x64.yaml +++ b/.github/workflows/windows-x64.yaml @@ -16,6 +16,7 @@ on: - '.github/scripts/test-offline-tts.sh' - '.github/scripts/test-audio-tagging.sh' - '.github/scripts/test-offline-punctuation.sh' + - '.github/scripts/test-online-punctuation.sh' - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' @@ -32,6 +33,7 @@ on: - '.github/scripts/test-offline-tts.sh' - '.github/scripts/test-audio-tagging.sh' - '.github/scripts/test-offline-punctuation.sh' + - '.github/scripts/test-online-punctuation.sh' - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' @@ -85,6 +87,14 @@ jobs: name: release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }} path: build/install/* + - name: Test online punctuation + shell: bash + run: | + export PATH=$PWD/build/bin/Release:$PATH + export EXE=sherpa-onnx-online-punctuation.exe + + .github/scripts/test-online-punctuation.sh + - name: Test offline punctuation shell: bash run: | diff --git a/.github/workflows/windows-x86.yaml b/.github/workflows/windows-x86.yaml index cfec7a86..316cef62 100644 --- a/.github/workflows/windows-x86.yaml +++ b/.github/workflows/windows-x86.yaml @@ -16,6 +16,7 @@ on: - '.github/scripts/test-online-ctc.sh' - '.github/scripts/test-audio-tagging.sh' - '.github/scripts/test-offline-punctuation.sh' + - '.github/scripts/test-online-punctuation.sh' - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' @@ -32,6 +33,7 @@ on: - '.github/scripts/test-online-ctc.sh' - '.github/scripts/test-audio-tagging.sh' - '.github/scripts/test-offline-punctuation.sh' + - '.github/scripts/test-online-punctuation.sh' - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' @@ -85,6 +87,14 @@ jobs: name: release-windows-x86-${{ matrix.shared_lib }}-${{ matrix.with_tts }} path: build/install/* + - name: Test online punctuation + shell: bash + run: | + export PATH=$PWD/build/bin/Release:$PATH + export EXE=sherpa-onnx-online-punctuation.exe + + .github/scripts/test-online-punctuation.sh + - name: Test offline punctuation shell: bash run: |