fix doc error in example command (#593) #16
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: Run C++ websocket tests | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- '.github/workflows/run-cpp-websocket-test.yaml' | |
- 'CMakeLists.txt' | |
- 'cmake/**' | |
- 'sherpa/csrc/**' | |
- 'sherpa/cpp_api/**' | |
pull_request: | |
types: [labeled] | |
paths: | |
- '.github/workflows/run-cpp-websocket-test.yaml' | |
- 'CMakeLists.txt' | |
- 'cmake/**' | |
- 'sherpa/csrc/**' | |
- 'sherpa/cpp_api/**' | |
concurrency: | |
group: run_cpp_websocket_tests-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
run_cpp_websocket_tests: | |
if: github.event.label.name == 'ready' || github.event.label.name == 'websocket' || github.event_name == 'push' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
torch: ["1.13.1"] | |
python-version: ["3.8"] | |
build_type: ["Release", "Debug"] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: ccache | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: ${{ matrix.os }}-${{ matrix.torch }}-${{ matrix.python-version }}-${{ matrix.build_type }} | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Display gcc version | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
gcc --version | |
- name: Display clang version | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
clang --version | |
- name: Install PyTorch ${{ matrix.torch }} | |
shell: bash | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
python3 -m pip install wheel twine typing_extensions | |
python3 -m pip install torch==${{ matrix.torch }} numpy -f https://download.pytorch.org/whl/cpu/torch_stable.html | |
python3 -m pip install k2==1.24.4.dev20240223+cpu.torch${{ matrix.torch }} -f https://k2-fsa.github.io/k2/cpu.html | |
python3 -m torch.utils.collect_env | |
- name: Install PyTorch ${{ matrix.torch }} | |
shell: bash | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
python3 -m pip install wheel twine typing_extensions | |
python3 -m pip install torch==${{ matrix.torch }} numpy -f https://download.pytorch.org/whl/cpu/torch_stable.html | |
python3 -m pip install k2==1.24.4.dev20240223+cpu.torch${{ matrix.torch }} -f https://k2-fsa.github.io/k2/cpu.html | |
python3 -m torch.utils.collect_env | |
- name: Cache kaldifeat | |
id: my-cache-2 | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/tmp/kaldifeat | |
key: cache-tmp-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.torch }} | |
- name: Install kaldifeat | |
if: steps.my-cache-2.outputs.cache-hit != 'true' | |
shell: bash | |
run: | | |
.github/scripts/install-kaldifeat.sh | |
- name: Build sherpa | |
shell: bash | |
env: | |
BUILD_TYPE: ${{ matrix.build_type }} | |
run: | | |
export KALDIFEAT_INSTALL_PREFIX=$HOME/tmp/kaldifeat/build | |
echo $KALDIFEAT_INSTALL_PREFIX | |
ls -lh $KALDIFEAT_INSTALL_PREFIX | |
echo "Build type: $BUILD_TYPE" | |
mkdir build | |
cd build | |
cmake \ | |
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \ | |
-DSHERPA_ENABLE_TESTS=ON \ | |
-DSHERPA_ENABLE_WEBSOCKET=ON .. | |
make -j2 VERBOSE=1 sherpa-offline-websocket-server sherpa-offline-websocket-client | |
ls -lh lib | |
ls -lh bin | |
- name: Download pretrained model and test-data | |
shell: bash | |
run: | | |
git lfs install | |
git clone https://huggingface.co/csukuangfj/icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13 | |
- name: Start the server | |
shell: bash | |
run: | | |
./build/bin/sherpa-offline-websocket-server \ | |
--use-gpu=false \ | |
--port=6006 \ | |
--num-io-threads=1 \ | |
--num-work-threads=1 \ | |
--max-batch-size=2 \ | |
--nn-model=./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/exp/cpu_jit-torch-${{ matrix.torch }}.pt \ | |
--tokens=./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/data/lang_bpe_500/tokens.txt \ | |
--decoding-method=greedy_search \ | |
--doc-root=./sherpa/bin/web \ | |
--log-file=./log.txt & | |
echo "Sleep 10 seconds to wait for the server startup" | |
sleep 10 | |
cat ./log.txt | |
- name: Start the client | |
shell: bash | |
run: | | |
./build/bin/sherpa-offline-websocket-client \ | |
--server-ip=127.0.0.1 \ | |
--server-port=6006 \ | |
./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/test_wavs/1089-134686-0001.wav | |
./build/bin/sherpa-offline-websocket-client \ | |
--server-ip=127.0.0.1 \ | |
--server-port=6006 \ | |
./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/test_wavs/1221-135766-0001.wav \ | |
./build/bin/sherpa-offline-websocket-client \ | |
--server-ip=127.0.0.1 \ | |
--server-port=6006 \ | |
./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/test_wavs/1221-135766-0002.wav | |
cat ./log.txt |