-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add workflow c-api-test-loading-tokens-hotwords-from-memory.yaml, for…
… test streaming models loading tokens and hotworks from buffered strings directly
- Loading branch information
xiao
committed
Sep 9, 2024
1 parent
610ab7e
commit ed4b2b5
Showing
1 changed file
with
119 additions
and
0 deletions.
There are no files selected for viewing
119 changes: 119 additions & 0 deletions
119
.github/workflows/c-api-test-loading-tokens-hotwords-from-memory.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
name: c-api-test-loading-tokens-hotwords-from-memory | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+*' | ||
paths: | ||
- '.github/workflows/c-api.yaml' | ||
- 'CMakeLists.txt' | ||
- 'cmake/**' | ||
- 'sherpa-onnx/csrc/*' | ||
- 'sherpa-onnx/c-api/*' | ||
- 'c-api-examples/**' | ||
- 'ffmpeg-examples/**' | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- '.github/workflows/c-api.yaml' | ||
- 'CMakeLists.txt' | ||
- 'cmake/**' | ||
- 'sherpa-onnx/csrc/*' | ||
- 'sherpa-onnx/c-api/*' | ||
- 'c-api-examples/**' | ||
- 'ffmpeg-examples/**' | ||
|
||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: c-api-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
c_api: | ||
name: ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: ccache | ||
uses: hendrikmuhs/[email protected] | ||
with: | ||
key: ${{ matrix.os }}-c-api-shared | ||
|
||
- name: Build sherpa-onnx | ||
shell: bash | ||
run: | | ||
export CMAKE_CXX_COMPILER_LAUNCHER=ccache | ||
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | ||
cmake --version | ||
mkdir build | ||
cd build | ||
cmake \ | ||
-D CMAKE_BUILD_TYPE=Release \ | ||
-D BUILD_SHARED_LIBS=ON \ | ||
-D CMAKE_INSTALL_PREFIX=./install \ | ||
-D SHERPA_ONNX_ENABLE_BINARY=OFF \ | ||
.. | ||
make -j2 install | ||
ls -lh install/lib | ||
ls -lh install/include | ||
if [[ ${{ matrix.os }} == ubuntu-latest ]]; then | ||
ldd ./install/lib/libsherpa-onnx-c-api.so | ||
echo "---" | ||
readelf -d ./install/lib/libsherpa-onnx-c-api.so | ||
fi | ||
if [[ ${{ matrix.os }} == macos-latest ]]; then | ||
otool -L ./install/lib/libsherpa-onnx-c-api.dylib | ||
fi | ||
- name: Test streaming zipformer with tokens and hotwords loaded from buffers | ||
shell: bash | ||
run: | | ||
gcc -o streaming-zipformer-buffered-tokens-hotwords-c-api ./c-api-examples/streaming-zipformer-buffered-tokens-hotwords-c-api.c \ | ||
-I ./build/install/include \ | ||
-L ./build/install/lib/ \ | ||
-l sherpa-onnx-c-api \ | ||
-l onnxruntime | ||
ls -lh streaming-zipformer-buffered-tokens-hotwords-c-api | ||
if [[ ${{ matrix.os }} == ubuntu-latest ]]; then | ||
ldd ./streaming-zipformer-buffered-tokens-hotwords-c-api | ||
echo "----" | ||
readelf -d ./streaming-zipformer-buffered-tokens-hotwords-c-api | ||
fi | ||
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-en-20M-2023-02-17.tar.bz2 | ||
tar xvf sherpa-onnx-streaming-zipformer-en-20M-2023-02-17.tar.bz2 | ||
rm sherpa-onnx-streaming-zipformer-en-20M-2023-02-17.tar.bz2 | ||
curl -SL -O https://huggingface.co/desh2608/icefall-asr-librispeech-pruned-transducer-stateless7-streaming-small/blob/main/data/lang_bpe_500/bpe.model | ||
cp bpe.model sherpa-onnx-streaming-zipformer-en-20M-2023-02-17/ | ||
rm bpe.model | ||
ls -lh sherpa-onnx-streaming-zipformer-en-20M-2023-02-17 | ||
echo "---" | ||
ls -lh sherpa-onnx-streaming-zipformer-en-20M-2023-02-17/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-zipformer-buffered-tokens-hotwords-c-api | ||
rm -rf sherpa-onnx-streaming-zipformer-* |