diff --git a/.github/workflows/linux-gpu.yaml b/.github/workflows/linux-gpu.yaml index ba7b4a004..6a7d2589e 100644 --- a/.github/workflows/linux-gpu.yaml +++ b/.github/workflows/linux-gpu.yaml @@ -12,6 +12,7 @@ on: - '.github/scripts/test-online-paraformer.sh' - '.github/scripts/test-offline-transducer.sh' - '.github/scripts/test-offline-ctc.sh' + - '.github/scripts/test-online-ctc.sh' - '.github/scripts/test-offline-tts.sh' - 'CMakeLists.txt' - 'cmake/**' @@ -27,6 +28,8 @@ on: - '.github/scripts/test-online-paraformer.sh' - '.github/scripts/test-offline-transducer.sh' - '.github/scripts/test-offline-ctc.sh' + - '.github/scripts/test-online-ctc.sh' + - '.github/scripts/test-online-ctc.sh' - '.github/scripts/test-offline-tts.sh' - 'CMakeLists.txt' - 'cmake/**' @@ -88,6 +91,14 @@ jobs: file build/bin/sherpa-onnx readelf -d build/bin/sherpa-onnx + - name: Test online CTC + shell: bash + run: | + export PATH=$PWD/build/bin:$PATH + export EXE=sherpa-onnx + + .github/scripts/test-online-ctc.sh + - name: Test offline TTS shell: bash run: | diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 54894459d..cbe4dac97 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -4,7 +4,6 @@ on: push: branches: - master - - online-wenet-ctc tags: - '*' paths: diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index e952b38a8..b73b0a504 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -13,6 +13,7 @@ on: - '.github/scripts/test-offline-transducer.sh' - '.github/scripts/test-offline-ctc.sh' - '.github/scripts/test-offline-tts.sh' + - '.github/scripts/test-online-ctc.sh' - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' @@ -26,6 +27,7 @@ on: - '.github/scripts/test-offline-transducer.sh' - '.github/scripts/test-offline-ctc.sh' - '.github/scripts/test-offline-tts.sh' + - '.github/scripts/test-online-ctc.sh' - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' @@ -96,6 +98,15 @@ jobs: otool -L build/bin/sherpa-onnx otool -l build/bin/sherpa-onnx + - name: Test online CTC + shell: bash + run: | + export PATH=$PWD/build/bin:$PATH + export EXE=sherpa-onnx + + .github/scripts/test-online-ctc.sh + + - name: Test offline TTS shell: bash run: | diff --git a/.github/workflows/windows-x64-cuda.yaml b/.github/workflows/windows-x64-cuda.yaml index e89f0ddd4..e9eea67d0 100644 --- a/.github/workflows/windows-x64-cuda.yaml +++ b/.github/workflows/windows-x64-cuda.yaml @@ -12,6 +12,7 @@ on: - '.github/scripts/test-online-paraformer.sh' - '.github/scripts/test-offline-transducer.sh' - '.github/scripts/test-offline-ctc.sh' + - '.github/scripts/test-online-ctc.sh' - '.github/scripts/test-offline-tts.sh' - 'CMakeLists.txt' - 'cmake/**' @@ -25,6 +26,7 @@ on: - '.github/scripts/test-online-paraformer.sh' - '.github/scripts/test-offline-transducer.sh' - '.github/scripts/test-offline-ctc.sh' + - '.github/scripts/test-online-ctc.sh' - '.github/scripts/test-offline-tts.sh' - 'CMakeLists.txt' - 'cmake/**' @@ -66,6 +68,14 @@ jobs: ls -lh ./bin/Release/sherpa-onnx.exe + - name: Test online CTC + shell: bash + run: | + export PATH=$PWD/build/bin/Release:$PATH + export EXE=sherpa-onnx-offline.exe + + .github/scripts/test-online-ctc.sh + - name: Test offline TTS shell: bash run: | diff --git a/.github/workflows/windows-x64.yaml b/.github/workflows/windows-x64.yaml index e929d1d01..aafb952a9 100644 --- a/.github/workflows/windows-x64.yaml +++ b/.github/workflows/windows-x64.yaml @@ -12,6 +12,7 @@ on: - '.github/scripts/test-online-paraformer.sh' - '.github/scripts/test-offline-transducer.sh' - '.github/scripts/test-offline-ctc.sh' + - '.github/scripts/test-online-ctc.sh' - '.github/scripts/test-offline-tts.sh' - 'CMakeLists.txt' - 'cmake/**' @@ -25,6 +26,7 @@ on: - '.github/scripts/test-online-paraformer.sh' - '.github/scripts/test-offline-transducer.sh' - '.github/scripts/test-offline-ctc.sh' + - '.github/scripts/test-online-ctc.sh' - '.github/scripts/test-offline-tts.sh' - 'CMakeLists.txt' - 'cmake/**' @@ -67,6 +69,14 @@ jobs: ls -lh ./bin/Release/sherpa-onnx.exe + - name: Test online CTC + shell: bash + run: | + export PATH=$PWD/build/bin/Release:$PATH + export EXE=sherpa-onnx-offline.exe + + .github/scripts/test-online-ctc.sh + - name: Test offline TTS shell: bash run: | diff --git a/.github/workflows/windows-x86.yaml b/.github/workflows/windows-x86.yaml index 1117ea257..4ca4f4b78 100644 --- a/.github/workflows/windows-x86.yaml +++ b/.github/workflows/windows-x86.yaml @@ -13,6 +13,7 @@ on: - '.github/scripts/test-offline-transducer.sh' - '.github/scripts/test-offline-ctc.sh' - '.github/scripts/test-offline-tts.sh' + - '.github/scripts/test-online-ctc.sh' - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' @@ -26,6 +27,7 @@ on: - '.github/scripts/test-offline-transducer.sh' - '.github/scripts/test-offline-ctc.sh' - '.github/scripts/test-offline-tts.sh' + - '.github/scripts/test-online-ctc.sh' - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' @@ -67,6 +69,14 @@ jobs: ls -lh ./bin/Release/sherpa-onnx.exe + - name: Test online CTC + shell: bash + run: | + export PATH=$PWD/build/bin/Release:$PATH + export EXE=sherpa-onnx-offline.exe + + .github/scripts/test-online-ctc.sh + - name: Test offline TTS shell: bash run: | diff --git a/scripts/wenet/export-onnx-streaming.py b/scripts/wenet/export-onnx-streaming.py index 27d8afde5..8ef7b2172 100755 --- a/scripts/wenet/export-onnx-streaming.py +++ b/scripts/wenet/export-onnx-streaming.py @@ -164,6 +164,7 @@ def main(): dynamic_axes={ "x": {0: "N", 1: "T"}, "attn_cache": {2: "T"}, + "attn_mask": {2: "T"}, "log_probs": {0: "N"}, "new_attn_cache": {2: "T"}, }, diff --git a/sherpa-onnx/csrc/online-recognizer-ctc-impl.h b/sherpa-onnx/csrc/online-recognizer-ctc-impl.h index 88e1fb4f5..85e779118 100644 --- a/sherpa-onnx/csrc/online-recognizer-ctc-impl.h +++ b/sherpa-onnx/csrc/online-recognizer-ctc-impl.h @@ -208,7 +208,7 @@ class OnlineRecognizerCtcImpl : public OnlineRecognizerImpl { states.reserve(num_states); for (int32_t i = 0; i != num_states; ++i) { - states[i] = std::move(out[i + 1]); + states.push_back(std::move(out[i + 1])); } s->SetStates(std::move(states));