From 8d8f4c8e1ae6dc89f5b606ecab33ef6a794ba023 Mon Sep 17 00:00:00 2001 From: xiao Date: Sun, 15 Sep 2024 19:13:42 +0800 Subject: [PATCH] updated workflow for testing streaming ctc and paraformer corrected ctc example model url updated CMakefile.txt for testring streaming ctc and paraformer --- .github/workflows/c-api-from-buffer.yaml | 64 +++++++++++++++++++ c-api-examples/CMakeLists.txt | 9 +++ ...aming-ctc-buffered-tokens-hotwords-c-api.c | 2 +- 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/.github/workflows/c-api-from-buffer.yaml b/.github/workflows/c-api-from-buffer.yaml index 49a5cf385..f1284625f 100644 --- a/.github/workflows/c-api-from-buffer.yaml +++ b/.github/workflows/c-api-from-buffer.yaml @@ -120,3 +120,67 @@ jobs: ./streaming-zipformer-buffered-tokens-hotwords-c-api rm -rf sherpa-onnx-streaming-zipformer-* + + - name: Test streaming paraformer with tokens and hotwords loaded from buffers + shell: bash + run: | + gcc -o streaming-paraformer-buffered-tokens-hotwords-c-api ./c-api-examples/streaming-paraformer-buffered-tokens-hotwords-c-api.c \ + -I ./build/install/include \ + -L ./build/install/lib/ \ + -l sherpa-onnx-c-api \ + -l onnxruntime + + ls -lh streaming-paraformer-buffered-tokens-hotwords-c-api + + if [[ ${{ matrix.os }} == ubuntu-latest ]]; then + ldd ./streaming-paraformer-buffered-tokens-hotwords-c-api + echo "----" + readelf -d ./streaming-paraformer-buffered-tokens-hotwords-c-api + fi + + 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 + + ls -lh sherpa-onnx-streaming-paraformer-bilingual-zh-en + echo "---" + ls -lh sherpa-onnx-streaming-paraformer-bilingual-zh-en/test_wavs + + export LD_LIBRARY_PATH=$PWD/build/install/lib:$LD_LIBRARY_PATH + export DYLD_LIBRARY_PATH=$PWD/build/install/lib:$DYLD_LIBRARY_PATH + + ./streaming-paraformer-buffered-tokens-hotwords-c-api + + rm -rf sherpa-onnx-streaming-paraformer-* + + - name: Test streaming ctc with tokens and hotwords loaded from buffers + shell: bash + run: | + gcc -o streaming-ctc-buffered-tokens-hotwords-c-api ./c-api-examples/streaming-ctc-buffered-tokens-hotwords-c-api.c \ + -I ./build/install/include \ + -L ./build/install/lib/ \ + -l sherpa-onnx-c-api \ + -l onnxruntime + + ls -lh streaming-ctc-buffered-tokens-hotwords-c-api + + if [[ ${{ matrix.os }} == ubuntu-latest ]]; then + ldd ./streaming-ctc-buffered-tokens-hotwords-c-api + echo "----" + readelf -d ./streaming-ctc-buffered-tokens-hotwords-c-api + fi + + 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 + + ls -lh sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13 + echo "---" + ls -lh sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13/test_wavs + + export LD_LIBRARY_PATH=$PWD/build/install/lib:$LD_LIBRARY_PATH + export DYLD_LIBRARY_PATH=$PWD/build/install/lib:$DYLD_LIBRARY_PATH + + ./streaming-ctc-buffered-tokens-hotwords-c-api + + rm -rf sherpa-onnx-streaming-ctc-* \ No newline at end of file diff --git a/c-api-examples/CMakeLists.txt b/c-api-examples/CMakeLists.txt index 954487f9f..e2af2d5fb 100644 --- a/c-api-examples/CMakeLists.txt +++ b/c-api-examples/CMakeLists.txt @@ -52,6 +52,15 @@ add_executable(streaming-zipformer-buffered-tokens-hotwords-c-api streaming-zipformer-buffered-tokens-hotwords-c-api.c) target_link_libraries(streaming-zipformer-buffered-tokens-hotwords-c-api sherpa-onnx-c-api) +add_executable(streaming-paraformer-buffered-tokens-hotwords-c-api + streaming-paraformer-buffered-tokens-hotwords-c-api.c) +target_link_libraries(streaming-paraformer-buffered-tokens-hotwords-c-api sherpa-onnx-c-api) + +add_executable(streaming-ctc-buffered-tokens-hotwords-c-api + streaming-ctc-buffered-tokens-hotwords-c-api.c) +target_link_libraries(streaming-ctc-buffered-tokens-hotwords-c-api sherpa-onnx-c-api) + + if(SHERPA_ONNX_HAS_ALSA) add_subdirectory(./asr-microphone-example) elseif((UNIX AND NOT APPLE) OR LINUX) diff --git a/c-api-examples/streaming-ctc-buffered-tokens-hotwords-c-api.c b/c-api-examples/streaming-ctc-buffered-tokens-hotwords-c-api.c index 39d1d938c..d6a90e59c 100644 --- a/c-api-examples/streaming-ctc-buffered-tokens-hotwords-c-api.c +++ b/c-api-examples/streaming-ctc-buffered-tokens-hotwords-c-api.c @@ -54,7 +54,7 @@ int32_t main() { "DEV_T0000000000.wav"; const char *model_filename = "sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13/" - "ctc-epoch-20-avg-1-chunk-16-left-128.int8"; + "ctc-epoch-20-avg-1-chunk-16-left-128.int8.onnx"; const char *tokens_filename = "sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13/tokens.txt"; const char *provider = "cpu";