Skip to content

Commit

Permalink
updated workflow for testing streaming ctc and paraformer
Browse files Browse the repository at this point in the history
corrected ctc example model url
updated CMakefile.txt for testring streaming ctc and paraformer
  • Loading branch information
xiao committed Sep 15, 2024
1 parent ada548d commit 8d8f4c8
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 1 deletion.
64 changes: 64 additions & 0 deletions .github/workflows/c-api-from-buffer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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-*
9 changes: 9 additions & 0 deletions c-api-examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 8d8f4c8

Please sign in to comment.