-
Notifications
You must be signed in to change notification settings - Fork 110
168 lines (139 loc) · 5.33 KB
/
run-cpp-websocket-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
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.23.4.dev20230319+cpu.torch${{ matrix.torch }} -f https://k2-fsa.org/nightly/index.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.23.4.dev20230319+cpu.torch${{ matrix.torch }} -f https://k2-fsa.org/nightly/index.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