Ebranchformer #246
Workflow file for this run
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
name: cxx-api | |
on: | |
push: | |
branches: | |
- master | |
- cxx-api-asr-non-streaming | |
paths: | |
- '.github/workflows/cxx-api.yaml' | |
- 'cmake/**' | |
- 'sherpa-onnx/csrc/*' | |
- 'sherpa-onnx/c-api/*' | |
- 'cxx-api-examples/**' | |
pull_request: | |
branches: | |
- master | |
paths: | |
- '.github/workflows/cxx-api.yaml' | |
- 'cmake/**' | |
- 'sherpa-onnx/csrc/*' | |
- 'sherpa-onnx/c-api/*' | |
- 'cxx-api-examples/**' | |
workflow_dispatch: | |
concurrency: | |
group: cxx-api-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
cxx_api: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, ubuntu-22.04-arm] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: ccache | |
uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: ${{ matrix.os }}-cxx-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 || ${{ matrix.os }} == ubuntu-22.04-arm ]]; then | |
ldd ./install/lib/libsherpa-onnx-c-api.so | |
ldd ./install/lib/libsherpa-onnx-cxx-api.so | |
echo "---" | |
readelf -d ./install/lib/libsherpa-onnx-c-api.so | |
readelf -d ./install/lib/libsherpa-onnx-cxx-api.so | |
fi | |
if [[ ${{ matrix.os }} == macos-latest ]]; then | |
otool -L ./install/lib/libsherpa-onnx-c-api.dylib | |
otool -L ./install/lib/libsherpa-onnx-cxx-api.dylib | |
fi | |
- name: Test FireRedAsr | |
shell: bash | |
run: | | |
g++ -std=c++17 -o fire-red-asr-cxx-api ./cxx-api-examples/fire-red-asr-cxx-api.cc \ | |
-I ./build/install/include \ | |
-L ./build/install/lib/ \ | |
-l sherpa-onnx-cxx-api \ | |
-l sherpa-onnx-c-api \ | |
-l onnxruntime | |
ls -lh fire-red-asr-cxx-api | |
export LD_LIBRARY_PATH=$PWD/build/install/lib:$LD_LIBRARY_PATH | |
export DYLD_LIBRARY_PATH=$PWD/build/install/lib:$DYLD_LIBRARY_PATH | |
if [[ ${{ matrix.os }} == ubuntu-latest || ${{ matrix.os }} == ubuntu-22.04-arm ]]; then | |
ldd ./fire-red-asr-cxx-api | |
echo "----" | |
readelf -d ./fire-red-asr-cxx-api | |
fi | |
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2 | |
tar xvf sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2 | |
rm sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2 | |
ls -lh sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16 | |
echo "---" | |
ls -lh sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/test_wavs | |
./fire-red-asr-cxx-api | |
rm -rf sherpa-onnx-fire-red-asr-* | |
- name: Test KWS (zh) | |
shell: bash | |
run: | | |
g++ -std=c++17 -o kws-cxx-api ./cxx-api-examples/kws-cxx-api.cc \ | |
-I ./build/install/include \ | |
-L ./build/install/lib/ \ | |
-l sherpa-onnx-cxx-api \ | |
-l sherpa-onnx-c-api \ | |
-l onnxruntime | |
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/kws-models/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile.tar.bz2 | |
tar xvf sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile.tar.bz2 | |
rm sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile.tar.bz2 | |
export LD_LIBRARY_PATH=$PWD/build/install/lib:$LD_LIBRARY_PATH | |
export DYLD_LIBRARY_PATH=$PWD/build/install/lib:$DYLD_LIBRARY_PATH | |
./kws-cxx-api | |
rm kws-cxx-api | |
rm -rf sherpa-onnx-kws-* | |
- name: Test Kokoro TTS (zh+en) | |
shell: bash | |
run: | | |
g++ -std=c++17 -o kokoro-tts-zh-en-cxx-api ./cxx-api-examples/kokoro-tts-zh-en-cxx-api.cc \ | |
-I ./build/install/include \ | |
-L ./build/install/lib/ \ | |
-l sherpa-onnx-cxx-api \ | |
-l sherpa-onnx-c-api \ | |
-l onnxruntime | |
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-multi-lang-v1_0.tar.bz2 | |
tar xf kokoro-multi-lang-v1_0.tar.bz2 | |
rm kokoro-multi-lang-v1_0.tar.bz2 | |
export LD_LIBRARY_PATH=$PWD/build/install/lib:$LD_LIBRARY_PATH | |
export DYLD_LIBRARY_PATH=$PWD/build/install/lib:$DYLD_LIBRARY_PATH | |
./kokoro-tts-zh-en-cxx-api | |
rm kokoro-tts-zh-en-cxx-api | |
rm -rf kokoro-* | |
- name: Test Kokoro TTS (en) | |
shell: bash | |
run: | | |
g++ -std=c++17 -o kokoro-tts-en-cxx-api ./cxx-api-examples/kokoro-tts-en-cxx-api.cc \ | |
-I ./build/install/include \ | |
-L ./build/install/lib/ \ | |
-l sherpa-onnx-cxx-api \ | |
-l sherpa-onnx-c-api \ | |
-l onnxruntime | |
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-en-v0_19.tar.bz2 | |
tar xf kokoro-en-v0_19.tar.bz2 | |
rm kokoro-en-v0_19.tar.bz2 | |
export LD_LIBRARY_PATH=$PWD/build/install/lib:$LD_LIBRARY_PATH | |
export DYLD_LIBRARY_PATH=$PWD/build/install/lib:$DYLD_LIBRARY_PATH | |
./kokoro-tts-en-cxx-api | |
rm kokoro-tts-en-cxx-api | |
rm -rf kokoro-en-* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: kokoro-tts-${{ matrix.os }} | |
path: ./generated-kokoro-*.wav | |
- name: Test Matcha TTS (zh) | |
shell: bash | |
run: | | |
g++ -std=c++17 -o matcha-tts-zh-cxx-api ./cxx-api-examples/matcha-tts-zh-cxx-api.cc \ | |
-I ./build/install/include \ | |
-L ./build/install/lib/ \ | |
-l sherpa-onnx-cxx-api \ | |
-l sherpa-onnx-c-api \ | |
-l onnxruntime | |
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/matcha-icefall-zh-baker.tar.bz2 | |
tar xvf matcha-icefall-zh-baker.tar.bz2 | |
rm matcha-icefall-zh-baker.tar.bz2 | |
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/vocoder-models/hifigan_v2.onnx | |
export LD_LIBRARY_PATH=$PWD/build/install/lib:$LD_LIBRARY_PATH | |
export DYLD_LIBRARY_PATH=$PWD/build/install/lib:$DYLD_LIBRARY_PATH | |
./matcha-tts-zh-cxx-api | |
rm -rf matcha-icefall-* | |
rm hifigan_v2.onnx | |
rm matcha-tts-zh-cxx-api | |
- name: Test Matcha TTS (en) | |
shell: bash | |
run: | | |
g++ -std=c++17 -o matcha-tts-en-cxx-api ./cxx-api-examples/matcha-tts-en-cxx-api.cc \ | |
-I ./build/install/include \ | |
-L ./build/install/lib/ \ | |
-l sherpa-onnx-cxx-api \ | |
-l sherpa-onnx-c-api \ | |
-l onnxruntime | |
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/matcha-icefall-en_US-ljspeech.tar.bz2 | |
tar xvf matcha-icefall-en_US-ljspeech.tar.bz2 | |
rm matcha-icefall-en_US-ljspeech.tar.bz2 | |
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/vocoder-models/hifigan_v2.onnx | |
export LD_LIBRARY_PATH=$PWD/build/install/lib:$LD_LIBRARY_PATH | |
export DYLD_LIBRARY_PATH=$PWD/build/install/lib:$DYLD_LIBRARY_PATH | |
./matcha-tts-en-cxx-api | |
rm matcha-tts-en-cxx-api | |
rm -rf matcha-icefall-* | |
rm hifigan_v2.onnx | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: matcha-tts-${{ matrix.os }} | |
path: ./generated-matcha-*.wav | |
- name: Test Moonshine tiny | |
shell: bash | |
run: | | |
g++ -std=c++17 -o moonshine-cxx-api ./cxx-api-examples/moonshine-cxx-api.cc \ | |
-I ./build/install/include \ | |
-L ./build/install/lib/ \ | |
-l sherpa-onnx-cxx-api \ | |
-l sherpa-onnx-c-api \ | |
-l onnxruntime | |
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-moonshine-tiny-en-int8.tar.bz2 | |
tar xvf sherpa-onnx-moonshine-tiny-en-int8.tar.bz2 | |
rm sherpa-onnx-moonshine-tiny-en-int8.tar.bz2 | |
export LD_LIBRARY_PATH=$PWD/build/install/lib:$LD_LIBRARY_PATH | |
export DYLD_LIBRARY_PATH=$PWD/build/install/lib:$DYLD_LIBRARY_PATH | |
./moonshine-cxx-api | |
rm -rf sherpa-onnx-* | |
rm ./moonshine-cxx-api | |
- name: Test whisper | |
shell: bash | |
run: | | |
g++ -std=c++17 -o whisper-cxx-api ./cxx-api-examples/whisper-cxx-api.cc \ | |
-I ./build/install/include \ | |
-L ./build/install/lib/ \ | |
-l sherpa-onnx-cxx-api \ | |
-l sherpa-onnx-c-api \ | |
-l onnxruntime | |
ls -lh whisper-cxx-api | |
if [[ ${{ matrix.os }} == ubuntu-latest || ${{ matrix.os }} == ubuntu-22.04-arm ]]; then | |
ldd ./whisper-cxx-api | |
echo "----" | |
readelf -d ./whisper-cxx-api | |
fi | |
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-whisper-tiny.en.tar.bz2 | |
tar xvf sherpa-onnx-whisper-tiny.en.tar.bz2 | |
rm sherpa-onnx-whisper-tiny.en.tar.bz2 | |
ls -lh sherpa-onnx-whisper-tiny.en | |
echo "---" | |
ls -lh sherpa-onnx-whisper-tiny.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 | |
./whisper-cxx-api | |
rm -rf sherpa-onnx-whisper-* | |
rm ./whisper-cxx-api | |
- name: Test SenseVoice | |
shell: bash | |
run: | | |
g++ -std=c++17 -o sense-voice-cxx-api ./cxx-api-examples/sense-voice-cxx-api.cc \ | |
-I ./build/install/include \ | |
-L ./build/install/lib/ \ | |
-l sherpa-onnx-cxx-api \ | |
-l sherpa-onnx-c-api \ | |
-l onnxruntime | |
ls -lh sense-voice-cxx-api | |
if [[ ${{ matrix.os }} == ubuntu-latest || ${{ matrix.os }} == ubuntu-22.04-arm ]]; then | |
ldd ./sense-voice-cxx-api | |
echo "----" | |
readelf -d ./sense-voice-cxx-api | |
fi | |
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17.tar.bz2 | |
tar xvf sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17.tar.bz2 | |
rm sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17.tar.bz2 | |
ls -lh sherpa-onnx-sense-voice-* | |
echo "---" | |
ls -lh sherpa-onnx-sense-voice-*/test_wavs | |
export LD_LIBRARY_PATH=$PWD/build/install/lib:$LD_LIBRARY_PATH | |
export DYLD_LIBRARY_PATH=$PWD/build/install/lib:$DYLD_LIBRARY_PATH | |
./sense-voice-cxx-api | |
rm -rf sherpa-onnx-sense-voice-* | |
rm ./sense-voice-cxx-api | |
- name: Test streaming zipformer | |
shell: bash | |
run: | | |
g++ -std=c++17 -o streaming-zipformer-cxx-api ./cxx-api-examples/streaming-zipformer-cxx-api.cc \ | |
-I ./build/install/include \ | |
-L ./build/install/lib/ \ | |
-l sherpa-onnx-cxx-api \ | |
-l sherpa-onnx-c-api \ | |
-l onnxruntime | |
ls -lh streaming-zipformer-cxx-api | |
if [[ ${{ matrix.os }} == ubuntu-latest || ${{ matrix.os }} == ubuntu-22.04-arm ]]; then | |
ldd ./streaming-zipformer-cxx-api | |
echo "----" | |
readelf -d ./streaming-zipformer-cxx-api | |
fi | |
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 | |
tar xvf sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 | |
rm sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 | |
ls -lh sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 | |
echo "---" | |
ls -lh sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/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-cxx-api | |
rm -rf sherpa-onnx-streaming-zipformer-* | |
rm ./streaming-zipformer-cxx-api |