Fangjun Kuang
Committed by GitHub

Refactor github actions tests (#688)

正在显示 42 个修改的文件 包含 591 行增加213 行删除
@@ -22,7 +22,7 @@ log "Start testing ${repo_url}" @@ -22,7 +22,7 @@ log "Start testing ${repo_url}"
22 repo=sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01 22 repo=sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01
23 23
24 log "Download pretrained model and test-data from $repo_url" 24 log "Download pretrained model and test-data from $repo_url"
25 -wget -qq $repo_url 25 +curl -SL -O $repo_url
26 tar jxvf ${repo}.tar.bz 26 tar jxvf ${repo}.tar.bz
27 27
28 time $EXE \ 28 time $EXE \
@@ -47,7 +47,7 @@ log "Start testing ${repo_url}" @@ -47,7 +47,7 @@ log "Start testing ${repo_url}"
47 repo=sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01 47 repo=sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01
48 48
49 log "Download pretrained model and test-data from $repo_url" 49 log "Download pretrained model and test-data from $repo_url"
50 -wget -qq $repo_url 50 +curl -SL -O $repo_url
51 tar jxvf ${repo}.tar.bz 51 tar jxvf ${repo}.tar.bz
52 52
53 time $EXE \ 53 time $EXE \
@@ -12,33 +12,46 @@ mkdir -p /tmp/icefall-models @@ -12,33 +12,46 @@ mkdir -p /tmp/icefall-models
12 dir=/tmp/icefall-models 12 dir=/tmp/icefall-models
13 13
14 pushd $dir 14 pushd $dir
15 -wget -qq https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13.tar.bz2  
16 -tar xvf sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13.tar.bz2  
17 -rm sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13.tar.bz2 15 +
  16 +repo=$dir/icefall-asr-librispeech-streaming-zipformer-small-2024-03-18
  17 +mkdir -p $repo
  18 +cd $repo
  19 +mkdir exp-ctc-rnnt-small
  20 +cd exp-ctc-rnnt-small
  21 +curl -LS -O https://huggingface.co/csukuangfj/icefall-asr-librispeech-streaming-zipformer-small-2024-03-18/resolve/main/exp-ctc-rnnt-small/ctc-epoch-30-avg-3-chunk-16-left-128.int8.onnx
  22 +cd ..
  23 +mkdir -p data/lang_bpe_500
  24 +cd data/lang_bpe_500
  25 +curl -LS -O https://huggingface.co/csukuangfj/icefall-asr-librispeech-streaming-zipformer-small-2024-03-18/resolve/main/data/lang_bpe_500/tokens.txt
  26 +cd ../..
  27 +mkdir test_wavs
  28 +cd test_wavs
  29 +
  30 +curl -LS -O https://huggingface.co/csukuangfj/icefall-asr-librispeech-streaming-zipformer-small-2024-03-18/resolve/main/test_wavs/0.wav
  31 +curl -LS -O https://huggingface.co/csukuangfj/icefall-asr-librispeech-streaming-zipformer-small-2024-03-18/resolve/main/test_wavs/1.wav
  32 +curl -LS -O https://huggingface.co/csukuangfj/icefall-asr-librispeech-streaming-zipformer-small-2024-03-18/resolve/main/test_wavs/8k.wav
18 popd 33 popd
19 -repo=$dir/sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13  
20 34
21 python3 ./python-api-examples/online-decode-files.py \ 35 python3 ./python-api-examples/online-decode-files.py \
22 - --tokens=$repo/tokens.txt \  
23 - --zipformer2-ctc=$repo/ctc-epoch-20-avg-1-chunk-16-left-128.onnx \  
24 - $repo/test_wavs/DEV_T0000000000.wav \  
25 - $repo/test_wavs/DEV_T0000000001.wav \  
26 - $repo/test_wavs/DEV_T0000000002.wav 36 + --tokens=$repo/data/lang_bpe_500/tokens.txt \
  37 + --zipformer2-ctc=$repo/exp-ctc-rnnt-small/ctc-epoch-30-avg-3-chunk-16-left-128.int8.onnx \
  38 + $repo/test_wavs/0.wav \
  39 + $repo/test_wavs/1.wav \
  40 + $repo/test_wavs/8k.wav
27 41
28 -python3 sherpa-onnx/python/tests/test_offline_recognizer.py --verbose 42 +rm -rf $repo
29 43
30 -rm -rf $dir/sherpa-onnx-streaming-zipformer-ctc-multi-zh-hans-2023-12-13 44 +python3 sherpa-onnx/python/tests/test_offline_recognizer.py --verbose
31 45
32 wenet_models=( 46 wenet_models=(
33 -sherpa-onnx-zh-wenet-aishell  
34 -sherpa-onnx-zh-wenet-aishell2  
35 -sherpa-onnx-zh-wenet-wenetspeech  
36 -sherpa-onnx-zh-wenet-multi-cn 47 +# sherpa-onnx-zh-wenet-aishell
  48 +# sherpa-onnx-zh-wenet-aishell2
  49 +# sherpa-onnx-zh-wenet-wenetspeech
  50 +# sherpa-onnx-zh-wenet-multi-cn
37 sherpa-onnx-en-wenet-librispeech 51 sherpa-onnx-en-wenet-librispeech
38 sherpa-onnx-en-wenet-gigaspeech 52 sherpa-onnx-en-wenet-gigaspeech
39 ) 53 )
40 54
41 -  
42 for name in ${wenet_models[@]}; do 55 for name in ${wenet_models[@]}; do
43 repo_url=https://huggingface.co/csukuangfj/$name 56 repo_url=https://huggingface.co/csukuangfj/$name
44 log "Start testing ${repo_url}" 57 log "Start testing ${repo_url}"
@@ -78,9 +91,9 @@ mkdir ./tts @@ -78,9 +91,9 @@ mkdir ./tts
78 91
79 log "vits-ljs test" 92 log "vits-ljs test"
80 93
81 -wget -qq https://huggingface.co/csukuangfj/vits-ljs/resolve/main/vits-ljs.onnx  
82 -wget -qq https://huggingface.co/csukuangfj/vits-ljs/resolve/main/lexicon.txt  
83 -wget -qq https://huggingface.co/csukuangfj/vits-ljs/resolve/main/tokens.txt 94 +curl -LS -O https://huggingface.co/csukuangfj/vits-ljs/resolve/main/vits-ljs.onnx
  95 +curl -LS -O https://huggingface.co/csukuangfj/vits-ljs/resolve/main/lexicon.txt
  96 +curl -LS -O https://huggingface.co/csukuangfj/vits-ljs/resolve/main/tokens.txt
84 97
85 python3 ./python-api-examples/offline-tts.py \ 98 python3 ./python-api-examples/offline-tts.py \
86 --vits-model=./vits-ljs.onnx \ 99 --vits-model=./vits-ljs.onnx \
@@ -94,9 +107,9 @@ ls -lh ./tts @@ -94,9 +107,9 @@ ls -lh ./tts
94 rm -v vits-ljs.onnx ./lexicon.txt ./tokens.txt 107 rm -v vits-ljs.onnx ./lexicon.txt ./tokens.txt
95 108
96 log "vits-vctk test" 109 log "vits-vctk test"
97 -wget -qq https://huggingface.co/csukuangfj/vits-vctk/resolve/main/vits-vctk.onnx  
98 -wget -qq https://huggingface.co/csukuangfj/vits-vctk/resolve/main/lexicon.txt  
99 -wget -qq https://huggingface.co/csukuangfj/vits-vctk/resolve/main/tokens.txt 110 +curl -LS -O https://huggingface.co/csukuangfj/vits-vctk/resolve/main/vits-vctk.onnx
  111 +curl -LS -O https://huggingface.co/csukuangfj/vits-vctk/resolve/main/lexicon.txt
  112 +curl -LS -O https://huggingface.co/csukuangfj/vits-vctk/resolve/main/tokens.txt
100 113
101 for sid in 0 10 90; do 114 for sid in 0 10 90; do
102 python3 ./python-api-examples/offline-tts.py \ 115 python3 ./python-api-examples/offline-tts.py \
@@ -110,74 +123,81 @@ done @@ -110,74 +123,81 @@ done
110 123
111 rm -v vits-vctk.onnx ./lexicon.txt ./tokens.txt 124 rm -v vits-vctk.onnx ./lexicon.txt ./tokens.txt
112 125
113 -log "vits-zh-aishell3" 126 +if [[ x$OS != x'windows-latest' ]]; then
  127 + echo "OS: $OS"
114 128
115 -wget -qq https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/vits-aishell3.onnx  
116 -wget -qq https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/lexicon.txt  
117 -wget -qq https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/tokens.txt 129 + log "vits-zh-aishell3"
118 130
119 -for sid in 0 10 90; do  
120 - python3 ./python-api-examples/offline-tts.py \  
121 - --vits-model=./vits-aishell3.onnx \  
122 - --vits-lexicon=./lexicon.txt \  
123 - --vits-tokens=./tokens.txt \  
124 - --sid=$sid \  
125 - --output-filename=./tts/vits-aishell3-${sid}.wav \  
126 - '林美丽最美丽'  
127 -done 131 + curl -LS -O https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/vits-aishell3.onnx
  132 + curl -LS -O https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/lexicon.txt
  133 + curl -LS -O https://huggingface.co/csukuangfj/vits-zh-aishell3/resolve/main/tokens.txt
128 134
129 -rm -v vits-aishell3.onnx ./lexicon.txt ./tokens.txt 135 + for sid in 0 10 90; do
  136 + python3 ./python-api-examples/offline-tts.py \
  137 + --vits-model=./vits-aishell3.onnx \
  138 + --vits-lexicon=./lexicon.txt \
  139 + --vits-tokens=./tokens.txt \
  140 + --sid=$sid \
  141 + --output-filename=./tts/vits-aishell3-${sid}.wav \
  142 + '林美丽最美丽'
  143 + done
  144 +
  145 + rm -v vits-aishell3.onnx ./lexicon.txt ./tokens.txt
  146 +fi
130 147
131 mkdir -p /tmp/icefall-models 148 mkdir -p /tmp/icefall-models
132 dir=/tmp/icefall-models 149 dir=/tmp/icefall-models
133 150
134 log "Test streaming transducer models" 151 log "Test streaming transducer models"
135 152
136 -pushd $dir  
137 -repo_url=https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 153 +if [[ x$OS != x'windows-latest' ]]; then
  154 + echo "OS: $OS"
  155 + pushd $dir
  156 + repo_url=https://huggingface.co/csukuangfj/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
138 157
139 -log "Start testing ${repo_url}"  
140 -repo=$dir/$(basename $repo_url)  
141 -log "Download pretrained model and test-data from $repo_url" 158 + log "Start testing ${repo_url}"
  159 + repo=$dir/$(basename $repo_url)
  160 + log "Download pretrained model and test-data from $repo_url"
142 161
143 -GIT_LFS_SKIP_SMUDGE=1 git clone $repo_url  
144 -cd $repo  
145 -git lfs pull --include "*.onnx"  
146 -popd 162 + GIT_LFS_SKIP_SMUDGE=1 git clone $repo_url
  163 + cd $repo
  164 + git lfs pull --include "*.onnx"
  165 + popd
147 166
148 -python3 -c "import sherpa_onnx; print(sherpa_onnx.__file__)"  
149 -sherpa_onnx_version=$(python3 -c "import sherpa_onnx; print(sherpa_onnx.__version__)") 167 + python3 -c "import sherpa_onnx; print(sherpa_onnx.__file__)"
  168 + sherpa_onnx_version=$(python3 -c "import sherpa_onnx; print(sherpa_onnx.__version__)")
150 169
151 -echo "sherpa_onnx version: $sherpa_onnx_version" 170 + echo "sherpa_onnx version: $sherpa_onnx_version"
152 171
153 -pwd  
154 -ls -lh 172 + pwd
  173 + ls -lh
155 174
156 -ls -lh $repo 175 + ls -lh $repo
157 176
158 -python3 ./python-api-examples/online-decode-files.py \  
159 - --tokens=$repo/tokens.txt \  
160 - --encoder=$repo/encoder-epoch-99-avg-1.onnx \  
161 - --decoder=$repo/decoder-epoch-99-avg-1.onnx \  
162 - --joiner=$repo/joiner-epoch-99-avg-1.onnx \  
163 - $repo/test_wavs/0.wav \  
164 - $repo/test_wavs/1.wav \  
165 - $repo/test_wavs/2.wav \  
166 - $repo/test_wavs/3.wav \  
167 - $repo/test_wavs/8k.wav 177 + python3 ./python-api-examples/online-decode-files.py \
  178 + --tokens=$repo/tokens.txt \
  179 + --encoder=$repo/encoder-epoch-99-avg-1.onnx \
  180 + --decoder=$repo/decoder-epoch-99-avg-1.onnx \
  181 + --joiner=$repo/joiner-epoch-99-avg-1.onnx \
  182 + $repo/test_wavs/0.wav \
  183 + $repo/test_wavs/1.wav \
  184 + $repo/test_wavs/2.wav \
  185 + $repo/test_wavs/3.wav \
  186 + $repo/test_wavs/8k.wav
168 187
169 -python3 ./python-api-examples/online-decode-files.py \  
170 - --tokens=$repo/tokens.txt \  
171 - --encoder=$repo/encoder-epoch-99-avg-1.int8.onnx \  
172 - --decoder=$repo/decoder-epoch-99-avg-1.int8.onnx \  
173 - --joiner=$repo/joiner-epoch-99-avg-1.int8.onnx \  
174 - $repo/test_wavs/0.wav \  
175 - $repo/test_wavs/1.wav \  
176 - $repo/test_wavs/2.wav \  
177 - $repo/test_wavs/3.wav \  
178 - $repo/test_wavs/8k.wav 188 + python3 ./python-api-examples/online-decode-files.py \
  189 + --tokens=$repo/tokens.txt \
  190 + --encoder=$repo/encoder-epoch-99-avg-1.int8.onnx \
  191 + --decoder=$repo/decoder-epoch-99-avg-1.int8.onnx \
  192 + --joiner=$repo/joiner-epoch-99-avg-1.int8.onnx \
  193 + $repo/test_wavs/0.wav \
  194 + $repo/test_wavs/1.wav \
  195 + $repo/test_wavs/2.wav \
  196 + $repo/test_wavs/3.wav \
  197 + $repo/test_wavs/8k.wav
179 198
180 -python3 sherpa-onnx/python/tests/test_online_recognizer.py --verbose 199 + python3 sherpa-onnx/python/tests/test_online_recognizer.py --verbose
  200 +fi
181 201
182 log "Test non-streaming transducer models" 202 log "Test non-streaming transducer models"
183 203
@@ -219,39 +239,42 @@ rm -rf $repo @@ -219,39 +239,42 @@ rm -rf $repo
219 239
220 log "Test non-streaming paraformer models" 240 log "Test non-streaming paraformer models"
221 241
222 -pushd $dir  
223 -repo_url=https://huggingface.co/csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28 242 +if [[ x$OS != x'windows-latest' ]]; then
  243 + echo "OS: $OS"
  244 + pushd $dir
  245 + repo_url=https://huggingface.co/csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28
224 246
225 -log "Start testing ${repo_url}"  
226 -repo=$dir/$(basename $repo_url)  
227 -log "Download pretrained model and test-data from $repo_url" 247 + log "Start testing ${repo_url}"
  248 + repo=$dir/$(basename $repo_url)
  249 + log "Download pretrained model and test-data from $repo_url"
228 250
229 -GIT_LFS_SKIP_SMUDGE=1 git clone $repo_url  
230 -cd $repo  
231 -git lfs pull --include "*.onnx"  
232 -popd 251 + GIT_LFS_SKIP_SMUDGE=1 git clone $repo_url
  252 + cd $repo
  253 + git lfs pull --include "*.onnx"
  254 + popd
233 255
234 -ls -lh $repo 256 + ls -lh $repo
235 257
236 -python3 ./python-api-examples/offline-decode-files.py \  
237 - --tokens=$repo/tokens.txt \  
238 - --paraformer=$repo/model.onnx \  
239 - $repo/test_wavs/0.wav \  
240 - $repo/test_wavs/1.wav \  
241 - $repo/test_wavs/2.wav \  
242 - $repo/test_wavs/8k.wav 258 + python3 ./python-api-examples/offline-decode-files.py \
  259 + --tokens=$repo/tokens.txt \
  260 + --paraformer=$repo/model.onnx \
  261 + $repo/test_wavs/0.wav \
  262 + $repo/test_wavs/1.wav \
  263 + $repo/test_wavs/2.wav \
  264 + $repo/test_wavs/8k.wav
243 265
244 -python3 ./python-api-examples/offline-decode-files.py \  
245 - --tokens=$repo/tokens.txt \  
246 - --paraformer=$repo/model.int8.onnx \  
247 - $repo/test_wavs/0.wav \  
248 - $repo/test_wavs/1.wav \  
249 - $repo/test_wavs/2.wav \  
250 - $repo/test_wavs/8k.wav 266 + python3 ./python-api-examples/offline-decode-files.py \
  267 + --tokens=$repo/tokens.txt \
  268 + --paraformer=$repo/model.int8.onnx \
  269 + $repo/test_wavs/0.wav \
  270 + $repo/test_wavs/1.wav \
  271 + $repo/test_wavs/2.wav \
  272 + $repo/test_wavs/8k.wav
251 273
252 -python3 sherpa-onnx/python/tests/test_offline_recognizer.py --verbose 274 + python3 sherpa-onnx/python/tests/test_offline_recognizer.py --verbose
253 275
254 -rm -rf $repo 276 + rm -rf $repo
  277 +fi
255 278
256 log "Test non-streaming NeMo CTC models" 279 log "Test non-streaming NeMo CTC models"
257 280
@@ -294,8 +317,8 @@ python3 sherpa-onnx/python/tests/test_text2token.py --verbose @@ -294,8 +317,8 @@ python3 sherpa-onnx/python/tests/test_text2token.py --verbose
294 317
295 rm -rf /tmp/sherpa-test-data 318 rm -rf /tmp/sherpa-test-data
296 319
297 -mkdir -p /tmp/onnx-models  
298 dir=/tmp/onnx-models 320 dir=/tmp/onnx-models
  321 +mkdir -p $dir
299 322
300 log "Test keyword spotting models" 323 log "Test keyword spotting models"
301 324
@@ -311,7 +334,7 @@ repo=sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01 @@ -311,7 +334,7 @@ repo=sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01
311 log "Start testing ${repo}" 334 log "Start testing ${repo}"
312 335
313 pushd $dir 336 pushd $dir
314 -wget -qq https://github.com/pkufool/keyword-spotting-models/releases/download/v0.1/sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01.tar.bz 337 +curl -LS -O https://github.com/pkufool/keyword-spotting-models/releases/download/v0.1/sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01.tar.bz
315 tar xf sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01.tar.bz 338 tar xf sherpa-onnx-kws-zipformer-gigaspeech-3.3M-2024-01-01.tar.bz
316 popd 339 popd
317 340
@@ -327,27 +350,35 @@ python3 ./python-api-examples/keyword-spotter.py \ @@ -327,27 +350,35 @@ python3 ./python-api-examples/keyword-spotter.py \
327 $repo/test_wavs/0.wav \ 350 $repo/test_wavs/0.wav \
328 $repo/test_wavs/1.wav 351 $repo/test_wavs/1.wav
329 352
330 -repo=sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01  
331 -log "Start testing ${repo}" 353 +rm -rf $repo
332 354
333 -pushd $dir  
334 -wget -qq https://github.com/pkufool/keyword-spotting-models/releases/download/v0.1/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz  
335 -tar xf sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz  
336 -popd 355 +if [[ x$OS != x'windows-latest' ]]; then
  356 + echo "OS: $OS"
337 357
338 -repo=$dir/$repo  
339 -ls -lh $repo 358 + repo=sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01
  359 + log "Start testing ${repo}"
340 360
341 -python3 ./python-api-examples/keyword-spotter.py \  
342 - --tokens=$repo/tokens.txt \  
343 - --encoder=$repo/encoder-epoch-12-avg-2-chunk-16-left-64.onnx \  
344 - --decoder=$repo/decoder-epoch-12-avg-2-chunk-16-left-64.onnx \  
345 - --joiner=$repo/joiner-epoch-12-avg-2-chunk-16-left-64.onnx \  
346 - --keywords-file=$repo/test_wavs/test_keywords.txt \  
347 - $repo/test_wavs/3.wav \  
348 - $repo/test_wavs/4.wav \  
349 - $repo/test_wavs/5.wav 361 + pushd $dir
  362 + curl -LS -O https://github.com/pkufool/keyword-spotting-models/releases/download/v0.1/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz
  363 + tar xf sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz
  364 + popd
350 365
351 -python3 sherpa-onnx/python/tests/test_keyword_spotter.py --verbose 366 + repo=$dir/$repo
  367 + ls -lh $repo
  368 +
  369 + python3 ./python-api-examples/keyword-spotter.py \
  370 + --tokens=$repo/tokens.txt \
  371 + --encoder=$repo/encoder-epoch-12-avg-2-chunk-16-left-64.onnx \
  372 + --decoder=$repo/decoder-epoch-12-avg-2-chunk-16-left-64.onnx \
  373 + --joiner=$repo/joiner-epoch-12-avg-2-chunk-16-left-64.onnx \
  374 + --keywords-file=$repo/test_wavs/test_keywords.txt \
  375 + $repo/test_wavs/3.wav \
  376 + $repo/test_wavs/4.wav \
  377 + $repo/test_wavs/5.wav
  378 +
  379 + python3 sherpa-onnx/python/tests/test_keyword_spotter.py --verbose
  380 +
  381 + rm -rf $repo
  382 +fi
352 383
353 rm -r $dir 384 rm -r $dir
@@ -32,8 +32,8 @@ wespeaker_zh_cnceleb_resnet34.onnx @@ -32,8 +32,8 @@ wespeaker_zh_cnceleb_resnet34.onnx
32 wespeaker_zh_cnceleb_resnet34_LM.onnx 32 wespeaker_zh_cnceleb_resnet34_LM.onnx
33 ) 33 )
34 for m in ${models[@]}; do 34 for m in ${models[@]}; do
35 - wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/$m  
36 - wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/wespeaker_en_voxceleb_CAM++_LM.onnx 35 + curl -LS -O https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/$m
  36 + curl -LS -O https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/wespeaker_en_voxceleb_CAM++_LM.onnx
37 done 37 done
38 ls -lh 38 ls -lh
39 popd 39 popd
@@ -52,7 +52,7 @@ models=( @@ -52,7 +52,7 @@ models=(
52 3dspeaker_speech_eres2net_sv_zh-cn_16k-common.onnx 52 3dspeaker_speech_eres2net_sv_zh-cn_16k-common.onnx
53 ) 53 )
54 for m in ${models[@]}; do 54 for m in ${models[@]}; do
55 - wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/$m 55 + curl -LS -O https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/$m
56 done 56 done
57 ls -lh 57 ls -lh
58 popd 58 popd
@@ -67,7 +67,7 @@ nemo_en_titanet_small.onnx @@ -67,7 +67,7 @@ nemo_en_titanet_small.onnx
67 nemo_en_speakerverification_speakernet.onnx 67 nemo_en_speakerverification_speakernet.onnx
68 ) 68 )
69 for m in ${models[@]}; do 69 for m in ${models[@]}; do
70 - wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/$m 70 + curl -LS -O https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/$m
71 done 71 done
72 ls -lh 72 ls -lh
73 popd 73 popd
@@ -9,7 +9,7 @@ ls -lh @@ -9,7 +9,7 @@ ls -lh
9 9
10 mkdir -p /Users/fangjun/Desktop 10 mkdir -p /Users/fangjun/Desktop
11 pushd /Users/fangjun/Desktop 11 pushd /Users/fangjun/Desktop
12 -wget -q https://huggingface.co/csukuangfj/test-data/resolve/main/Obama.wav 12 +curl -SL -O https://huggingface.co/csukuangfj/test-data/resolve/main/Obama.wav
13 ls -lh 13 ls -lh
14 popd 14 popd
15 15
@@ -12,6 +12,7 @@ on: @@ -12,6 +12,7 @@ on:
12 - 'CMakeLists.txt' 12 - 'CMakeLists.txt'
13 - 'cmake/**' 13 - 'cmake/**'
14 - 'sherpa-onnx/csrc/*' 14 - 'sherpa-onnx/csrc/*'
  15 + - 'sherpa-onnx/c-api/*'
15 - 'toolchains/aarch64-linux-gnu.toolchain.cmake' 16 - 'toolchains/aarch64-linux-gnu.toolchain.cmake'
16 pull_request: 17 pull_request:
17 branches: 18 branches:
@@ -21,6 +22,7 @@ on: @@ -21,6 +22,7 @@ on:
21 - 'CMakeLists.txt' 22 - 'CMakeLists.txt'
22 - 'cmake/**' 23 - 'cmake/**'
23 - 'sherpa-onnx/csrc/*' 24 - 'sherpa-onnx/csrc/*'
  25 + - 'sherpa-onnx/c-api/*'
24 - 'toolchains/aarch64-linux-gnu.toolchain.cmake' 26 - 'toolchains/aarch64-linux-gnu.toolchain.cmake'
25 27
26 workflow_dispatch: 28 workflow_dispatch:
@@ -82,16 +84,16 @@ jobs: @@ -82,16 +84,16 @@ jobs:
82 uses: actions/cache@v4 84 uses: actions/cache@v4
83 with: 85 with:
84 path: toolchain 86 path: toolchain
85 - key: gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz 87 + key: gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz
86 88
87 - name: Download toolchain 89 - name: Download toolchain
88 if: steps.cache-toolchain.outputs.cache-hit != 'true' 90 if: steps.cache-toolchain.outputs.cache-hit != 'true'
89 shell: bash 91 shell: bash
90 run: | 92 run: |
91 - wget -qq https://huggingface.co/csukuangfj/sherpa-ncnn-toolchains/resolve/main/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz 93 + wget -qq https://huggingface.co/csukuangfj/sherpa-ncnn-toolchains/resolve/main/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz
92 94
93 mkdir $GITHUB_WORKSPACE/toolchain 95 mkdir $GITHUB_WORKSPACE/toolchain
94 - tar xf ./gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz --strip-components 1 -C $GITHUB_WORKSPACE/toolchain 96 + tar xf ./gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz --strip-components 1 -C $GITHUB_WORKSPACE/toolchain
95 97
96 - name: Set environment variable 98 - name: Set environment variable
97 if: steps.cache-build-result.outputs.cache-hit != 'true' 99 if: steps.cache-build-result.outputs.cache-hit != 'true'
@@ -101,19 +103,19 @@ jobs: @@ -101,19 +103,19 @@ jobs:
101 echo "$GITHUB_WORKSPACE/bin" >> "$GITHUB_PATH" 103 echo "$GITHUB_WORKSPACE/bin" >> "$GITHUB_PATH"
102 ls -lh "$GITHUB_WORKSPACE/toolchain/bin" 104 ls -lh "$GITHUB_WORKSPACE/toolchain/bin"
103 105
104 - echo "CC=aarch64-none-linux-gnu-gcc" >> "$GITHUB_ENV"  
105 - echo "CXX=aarch64-none-linux-gnu-g++" >> "$GITHUB_ENV" 106 + echo "CC=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
  107 + echo "CXX=aarch64-linux-gnu-g++" >> "$GITHUB_ENV"
106 108
107 - name: Display toolchain info 109 - name: Display toolchain info
108 shell: bash 110 shell: bash
109 run: | 111 run: |
110 - aarch64-none-linux-gnu-gcc --version 112 + aarch64-linux-gnu-gcc --version
111 113
112 - name: Display qemu-aarch64 -h 114 - name: Display qemu-aarch64 -h
113 shell: bash 115 shell: bash
114 run: | 116 run: |
115 export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH 117 export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH
116 - export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/aarch64-none-linux-gnu/libc 118 + export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/aarch64-linux-gnu/libc
117 qemu-aarch64 -h 119 qemu-aarch64 -h
118 120
119 - name: build aarch64-linux-gnu 121 - name: build aarch64-linux-gnu
@@ -138,7 +140,7 @@ jobs: @@ -138,7 +140,7 @@ jobs:
138 run: | 140 run: |
139 export PATH=$GITHUB_WORKSPACE/toolchain/bin:$PATH 141 export PATH=$GITHUB_WORKSPACE/toolchain/bin:$PATH
140 export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH 142 export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH
141 - export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/aarch64-none-linux-gnu/libc 143 + export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/aarch64-linux-gnu/libc
142 144
143 ls -lh ./build-aarch64-linux-gnu/bin 145 ls -lh ./build-aarch64-linux-gnu/bin
144 146
@@ -149,7 +151,7 @@ jobs: @@ -149,7 +151,7 @@ jobs:
149 - name: Copy files 151 - name: Copy files
150 shell: bash 152 shell: bash
151 run: | 153 run: |
152 - aarch64-none-linux-gnu-strip --version 154 + aarch64-linux-gnu-strip --version
153 155
154 SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) 156 SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
155 157
@@ -164,7 +166,7 @@ jobs: @@ -164,7 +166,7 @@ jobs:
164 166
165 ls -lh $dst/bin/ 167 ls -lh $dst/bin/
166 echo "strip" 168 echo "strip"
167 - aarch64-none-linux-gnu-strip $dst/bin/* 169 + aarch64-linux-gnu-strip $dst/bin/*
168 170
169 tree $dst 171 tree $dst
170 172
@@ -175,6 +177,38 @@ jobs: @@ -175,6 +177,38 @@ jobs:
175 name: sherpa-onnx-linux-aarch64-shared 177 name: sherpa-onnx-linux-aarch64-shared
176 path: sherpa-onnx-*linux-aarch64-shared.tar.bz2 178 path: sherpa-onnx-*linux-aarch64-shared.tar.bz2
177 179
  180 + # https://huggingface.co/docs/hub/spaces-github-actions
  181 + - name: Publish to huggingface
  182 + if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
  183 + env:
  184 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
  185 + uses: nick-fields/retry@v3
  186 + with:
  187 + max_attempts: 20
  188 + timeout_seconds: 200
  189 + shell: bash
  190 + command: |
  191 + git config --global user.email "csukuangfj@gmail.com"
  192 + git config --global user.name "Fangjun Kuang"
  193 +
  194 + rm -rf huggingface
  195 + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
  196 +
  197 + cd huggingface
  198 + git lfs pull
  199 + mkdir -p aarch64
  200 +
  201 + cp -v ../sherpa-onnx-*-shared.tar.bz2 ./aarch64
  202 +
  203 + git status
  204 + git lfs track "*.bz2"
  205 +
  206 + git add .
  207 +
  208 + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-aarch64-shared.tar.bz2"
  209 +
  210 + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
  211 +
178 - name: Release pre-compiled binaries and libs for aarch64 linux 212 - name: Release pre-compiled binaries and libs for aarch64 linux
179 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') 213 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
180 uses: svenstaro/upload-release-action@v2 214 uses: svenstaro/upload-release-action@v2
@@ -12,6 +12,7 @@ on: @@ -12,6 +12,7 @@ on:
12 - 'CMakeLists.txt' 12 - 'CMakeLists.txt'
13 - 'cmake/**' 13 - 'cmake/**'
14 - 'sherpa-onnx/csrc/*' 14 - 'sherpa-onnx/csrc/*'
  15 + - 'sherpa-onnx/c-api/*'
15 - 'toolchains/aarch64-linux-gnu.toolchain.cmake' 16 - 'toolchains/aarch64-linux-gnu.toolchain.cmake'
16 pull_request: 17 pull_request:
17 branches: 18 branches:
@@ -21,6 +22,7 @@ on: @@ -21,6 +22,7 @@ on:
21 - 'CMakeLists.txt' 22 - 'CMakeLists.txt'
22 - 'cmake/**' 23 - 'cmake/**'
23 - 'sherpa-onnx/csrc/*' 24 - 'sherpa-onnx/csrc/*'
  25 + - 'sherpa-onnx/c-api/*'
24 - 'toolchains/aarch64-linux-gnu.toolchain.cmake' 26 - 'toolchains/aarch64-linux-gnu.toolchain.cmake'
25 27
26 workflow_dispatch: 28 workflow_dispatch:
@@ -166,6 +168,38 @@ jobs: @@ -166,6 +168,38 @@ jobs:
166 name: sherpa-onnx-linux-aarch64-static 168 name: sherpa-onnx-linux-aarch64-static
167 path: sherpa-onnx-*linux-aarch64-static.tar.bz2 169 path: sherpa-onnx-*linux-aarch64-static.tar.bz2
168 170
  171 + # https://huggingface.co/docs/hub/spaces-github-actions
  172 + - name: Publish to huggingface
  173 + if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
  174 + env:
  175 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
  176 + uses: nick-fields/retry@v3
  177 + with:
  178 + max_attempts: 20
  179 + timeout_seconds: 200
  180 + shell: bash
  181 + command: |
  182 + git config --global user.email "csukuangfj@gmail.com"
  183 + git config --global user.name "Fangjun Kuang"
  184 +
  185 + rm -rf huggingface
  186 + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
  187 +
  188 + cd huggingface
  189 + git lfs pull
  190 + mkdir -p aarch64
  191 +
  192 + cp -v ../sherpa-onnx-*-static.tar.bz2 ./aarch64
  193 +
  194 + git status
  195 + git lfs track "*.bz2"
  196 +
  197 + git add .
  198 +
  199 + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-aarch64-static.tar.bz2"
  200 +
  201 + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
  202 +
169 - name: Release pre-compiled binaries and libs for aarch64 linux 203 - name: Release pre-compiled binaries and libs for aarch64 linux
170 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') 204 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
171 uses: svenstaro/upload-release-action@v2 205 uses: svenstaro/upload-release-action@v2
@@ -25,15 +25,6 @@ on: @@ -25,15 +25,6 @@ on:
25 - 'build-android*.sh' 25 - 'build-android*.sh'
26 26
27 workflow_dispatch: 27 workflow_dispatch:
28 - inputs:  
29 - release:  
30 - description: "Whether to release"  
31 - type: boolean  
32 -  
33 -env:  
34 - RELEASE:  
35 - |- # Release if there is a release tag name or a release flag in workflow_dispatch  
36 - ${{ github.event.release.tag_name != '' || github.event.inputs.release == 'true' }}  
37 28
38 concurrency: 29 concurrency:
39 group: android-${{ github.ref }} 30 group: android-${{ github.ref }}
@@ -2,8 +2,6 @@ name: apk-kws @@ -2,8 +2,6 @@ name: apk-kws
2 2
3 on: 3 on:
4 push: 4 push:
5 - branches:  
6 - - apk-kws  
7 tags: 5 tags:
8 - '*' 6 - '*'
9 7
@@ -17,7 +15,7 @@ permissions: @@ -17,7 +15,7 @@ permissions:
17 contents: write 15 contents: write
18 16
19 jobs: 17 jobs:
20 - apk: 18 + apk_kws:
21 runs-on: ${{ matrix.os }} 19 runs-on: ${{ matrix.os }}
22 strategy: 20 strategy:
23 fail-fast: false 21 fail-fast: false
@@ -2,8 +2,6 @@ name: apk-speaker-identification @@ -2,8 +2,6 @@ name: apk-speaker-identification
2 2
3 on: 3 on:
4 push: 4 push:
5 - branches:  
6 - - apk  
7 tags: 5 tags:
8 - '*' 6 - '*'
9 7
@@ -17,7 +15,7 @@ permissions: @@ -17,7 +15,7 @@ permissions:
17 contents: write 15 contents: write
18 16
19 jobs: 17 jobs:
20 - apk_tts: 18 + apk_speaker_identification:
21 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' 19 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
22 runs-on: ${{ matrix.os }} 20 runs-on: ${{ matrix.os }}
23 name: apk for tts ${{ matrix.index }}/${{ matrix.total }} 21 name: apk for tts ${{ matrix.index }}/${{ matrix.total }}
@@ -84,18 +82,7 @@ jobs: @@ -84,18 +82,7 @@ jobs:
84 ls -lh ./apks/ 82 ls -lh ./apks/
85 du -h -d1 . 83 du -h -d1 .
86 84
87 - # - name: Release  
88 - # uses: svenstaro/upload-release-action@v2  
89 - # with:  
90 - # file_glob: true  
91 - # file: ./apks/*.apk  
92 - # overwrite: true  
93 - # repo_name: k2-fsa/sherpa-onnx  
94 - # repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}  
95 - # tag: speaker-recongition-models  
96 -  
97 - name: Publish to huggingface 85 - name: Publish to huggingface
98 - if: true  
99 env: 86 env:
100 HF_TOKEN: ${{ secrets.HF_TOKEN }} 87 HF_TOKEN: ${{ secrets.HF_TOKEN }}
101 uses: nick-fields/retry@v3 88 uses: nick-fields/retry@v3
@@ -2,8 +2,6 @@ name: apk-tts-engine @@ -2,8 +2,6 @@ name: apk-tts-engine
2 2
3 on: 3 on:
4 push: 4 push:
5 - branches:  
6 - - apk-tts  
7 tags: 5 tags:
8 - '*' 6 - '*'
9 7
@@ -2,9 +2,6 @@ name: apk-tts @@ -2,9 +2,6 @@ name: apk-tts
2 2
3 on: 3 on:
4 push: 4 push:
5 - branches:  
6 - - apk-tts  
7 - - apk  
8 tags: 5 tags:
9 - '*' 6 - '*'
10 7
@@ -2,8 +2,6 @@ name: apk @@ -2,8 +2,6 @@ name: apk
2 2
3 on: 3 on:
4 push: 4 push:
5 - branches:  
6 - - apk  
7 tags: 5 tags:
8 - '*' 6 - '*'
9 7
@@ -10,6 +10,7 @@ on: @@ -10,6 +10,7 @@ on:
10 - 'CMakeLists.txt' 10 - 'CMakeLists.txt'
11 - 'cmake/**' 11 - 'cmake/**'
12 - 'sherpa-onnx/csrc/*' 12 - 'sherpa-onnx/csrc/*'
  13 + - 'sherpa-onnx/c-api/*'
13 - 'toolchains/arm-linux-gnueabihf.toolchain.cmake' 14 - 'toolchains/arm-linux-gnueabihf.toolchain.cmake'
14 tags: 15 tags:
15 - '*' 16 - '*'
@@ -21,6 +22,7 @@ on: @@ -21,6 +22,7 @@ on:
21 - 'CMakeLists.txt' 22 - 'CMakeLists.txt'
22 - 'cmake/**' 23 - 'cmake/**'
23 - 'sherpa-onnx/csrc/*' 24 - 'sherpa-onnx/csrc/*'
  25 + - 'sherpa-onnx/c-api/*'
24 - 'toolchains/arm-linux-gnueabihf.toolchain.cmake' 26 - 'toolchains/arm-linux-gnueabihf.toolchain.cmake'
25 27
26 workflow_dispatch: 28 workflow_dispatch:
@@ -189,6 +191,38 @@ jobs: @@ -189,6 +191,38 @@ jobs:
189 name: sherpa-onnx-linux-arm-gnueabihf-static 191 name: sherpa-onnx-linux-arm-gnueabihf-static
190 path: sherpa-onnx-*linux-arm-gnueabihf-static.tar.bz2 192 path: sherpa-onnx-*linux-arm-gnueabihf-static.tar.bz2
191 193
  194 + # https://huggingface.co/docs/hub/spaces-github-actions
  195 + - name: Publish to huggingface
  196 + if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
  197 + env:
  198 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
  199 + uses: nick-fields/retry@v3
  200 + with:
  201 + max_attempts: 20
  202 + timeout_seconds: 200
  203 + shell: bash
  204 + command: |
  205 + git config --global user.email "csukuangfj@gmail.com"
  206 + git config --global user.name "Fangjun Kuang"
  207 +
  208 + rm -rf huggingface
  209 + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
  210 +
  211 + cd huggingface
  212 + git lfs pull
  213 + mkdir -p arm32
  214 +
  215 + cp -v ../sherpa-onnx-*.tar.bz2 ./arm32
  216 +
  217 + git status
  218 + git lfs track "*.bz2"
  219 +
  220 + git add .
  221 +
  222 + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}"
  223 +
  224 + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
  225 +
192 - name: Release pre-compiled binaries and libs for arm linux gnueabihf ${{ matrix.lib_type }} 226 - name: Release pre-compiled binaries and libs for arm linux gnueabihf ${{ matrix.lib_type }}
193 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') 227 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
194 uses: svenstaro/upload-release-action@v2 228 uses: svenstaro/upload-release-action@v2
@@ -2,8 +2,6 @@ name: build-wheels-aarch64 @@ -2,8 +2,6 @@ name: build-wheels-aarch64
2 2
3 on: 3 on:
4 push: 4 push:
5 - branches:  
6 - - wheel  
7 tags: 5 tags:
8 - '*' 6 - '*'
9 workflow_dispatch: 7 workflow_dispatch:
@@ -61,10 +59,8 @@ jobs: @@ -61,10 +59,8 @@ jobs:
61 run: | 59 run: |
62 ls -lh ./wheelhouse/ 60 ls -lh ./wheelhouse/
63 61
64 - ls -lh ./wheelhouse/*.whl  
65 -  
66 - name: Publish to huggingface 62 - name: Publish to huggingface
67 - if: matrix.python-version == 'cp38' && matrix.manylinux == 'manylinux_2_28' 63 + if: matrix.python-version == 'cp38' && matrix.manylinux == 'manylinux2014'
68 env: 64 env:
69 HF_TOKEN: ${{ secrets.HF_TOKEN }} 65 HF_TOKEN: ${{ secrets.HF_TOKEN }}
70 uses: nick-fields/retry@v3 66 uses: nick-fields/retry@v3
@@ -2,8 +2,6 @@ name: build-wheels-armv7l @@ -2,8 +2,6 @@ name: build-wheels-armv7l
2 2
3 on: 3 on:
4 push: 4 push:
5 - branches:  
6 - - wheel  
7 tags: 5 tags:
8 - '*' 6 - '*'
9 workflow_dispatch: 7 workflow_dispatch:
@@ -2,8 +2,6 @@ name: build-wheels-linux @@ -2,8 +2,6 @@ name: build-wheels-linux
2 2
3 on: 3 on:
4 push: 4 push:
5 - branches:  
6 - - wheel  
7 tags: 5 tags:
8 - '*' 6 - '*'
9 workflow_dispatch: 7 workflow_dispatch:
@@ -12,7 +10,7 @@ env: @@ -12,7 +10,7 @@ env:
12 SHERPA_ONNX_IS_IN_GITHUB_ACTIONS: 1 10 SHERPA_ONNX_IS_IN_GITHUB_ACTIONS: 1
13 11
14 concurrency: 12 concurrency:
15 - group: build-wheels-${{ github.ref }} 13 + group: build-wheels-linux-${{ github.ref }}
16 cancel-in-progress: true 14 cancel-in-progress: true
17 15
18 jobs: 16 jobs:
@@ -84,6 +82,7 @@ jobs: @@ -84,6 +82,7 @@ jobs:
84 env: 82 env:
85 HF_TOKEN: ${{ secrets.HF_TOKEN }} 83 HF_TOKEN: ${{ secrets.HF_TOKEN }}
86 uses: nick-fields/retry@v3 84 uses: nick-fields/retry@v3
  85 + shell: bash
87 with: 86 with:
88 max_attempts: 20 87 max_attempts: 20
89 timeout_seconds: 200 88 timeout_seconds: 200
@@ -112,6 +111,7 @@ jobs: @@ -112,6 +111,7 @@ jobs:
112 env: 111 env:
113 TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} 112 TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
114 TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} 113 TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
  114 + shell: bash
115 run: | 115 run: |
116 python3 -m pip install --upgrade pip 116 python3 -m pip install --upgrade pip
117 python3 -m pip install wheel twine setuptools 117 python3 -m pip install wheel twine setuptools
@@ -119,16 +119,17 @@ jobs: @@ -119,16 +119,17 @@ jobs:
119 twine upload ./wheelhouse/*.whl 119 twine upload ./wheelhouse/*.whl
120 120
121 - name: Build sdist 121 - name: Build sdist
122 - if: matrix.python-version == 'cp38' && matrix.manylinux == 'manylinux_2_28' 122 + if: matrix.python-version == 'cp38' && matrix.manylinux == 'manylinux2014'
123 shell: bash 123 shell: bash
124 run: | 124 run: |
125 python3 setup.py sdist 125 python3 setup.py sdist
126 ls -l dist/* 126 ls -l dist/*
127 127
128 - name: Publish sdist to PyPI 128 - name: Publish sdist to PyPI
129 - if: matrix.python-version == 'cp38' && matrix.manylinux == 'manylinux_2_28' 129 + if: matrix.python-version == 'cp38' && matrix.manylinux == 'manylinux2014'
130 env: 130 env:
131 TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} 131 TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
132 TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} 132 TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
  133 + shell: bash
133 run: | 134 run: |
134 twine upload dist/sherpa-onnx-*.tar.gz 135 twine upload dist/sherpa-onnx-*.tar.gz
@@ -2,8 +2,6 @@ name: build-wheels-macos-arm64 @@ -2,8 +2,6 @@ name: build-wheels-macos-arm64
2 2
3 on: 3 on:
4 push: 4 push:
5 - branches:  
6 - - wheel  
7 tags: 5 tags:
8 - '*' 6 - '*'
9 workflow_dispatch: 7 workflow_dispatch:
@@ -16,7 +14,7 @@ concurrency: @@ -16,7 +14,7 @@ concurrency:
16 cancel-in-progress: true 14 cancel-in-progress: true
17 15
18 jobs: 16 jobs:
19 - build_wheels: 17 + build_wheels_macos_arm64:
20 name: ${{ matrix.python-version }} 18 name: ${{ matrix.python-version }}
21 runs-on: ${{ matrix.os }} 19 runs-on: ${{ matrix.os }}
22 strategy: 20 strategy:
@@ -34,6 +32,7 @@ jobs: @@ -34,6 +32,7 @@ jobs:
34 if: matrix.python-version == 'cp37' 32 if: matrix.python-version == 'cp37'
35 uses: pypa/cibuildwheel@v2.11.4 33 uses: pypa/cibuildwheel@v2.11.4
36 env: 34 env:
  35 + CIBW_BUILD: "${{ matrix.python-version}}-* "
37 CIBW_ENVIRONMENT: SHERPA_ONNX_CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES='arm64'" 36 CIBW_ENVIRONMENT: SHERPA_ONNX_CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES='arm64'"
38 CIBW_ARCHS: "arm64" 37 CIBW_ARCHS: "arm64"
39 CIBW_BUILD_VERBOSITY: 3 38 CIBW_BUILD_VERBOSITY: 3
@@ -58,8 +57,6 @@ jobs: @@ -58,8 +57,6 @@ jobs:
58 run: | 57 run: |
59 ls -lh ./wheelhouse/ 58 ls -lh ./wheelhouse/
60 59
61 - ls -lh ./wheelhouse/*.whl  
62 -  
63 - uses: actions/upload-artifact@v4 60 - uses: actions/upload-artifact@v4
64 with: 61 with:
65 name: wheel-${{ matrix.python-version }} 62 name: wheel-${{ matrix.python-version }}
@@ -16,7 +16,7 @@ concurrency: @@ -16,7 +16,7 @@ concurrency:
16 cancel-in-progress: true 16 cancel-in-progress: true
17 17
18 jobs: 18 jobs:
19 - build_wheels: 19 + build_wheels_macos_x64:
20 name: ${{ matrix.python-version }} 20 name: ${{ matrix.python-version }}
21 runs-on: ${{ matrix.os }} 21 runs-on: ${{ matrix.os }}
22 strategy: 22 strategy:
@@ -41,6 +41,7 @@ jobs: @@ -41,6 +41,7 @@ jobs:
41 41
42 # Don't repair macOS wheels 42 # Don't repair macOS wheels
43 CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" 43 CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
  44 +
44 - name: Build wheels 45 - name: Build wheels
45 if: matrix.python-version != 'cp37' 46 if: matrix.python-version != 'cp37'
46 uses: pypa/cibuildwheel@v2.15.0 47 uses: pypa/cibuildwheel@v2.15.0
@@ -2,8 +2,6 @@ name: build-wheels-win32 @@ -2,8 +2,6 @@ name: build-wheels-win32
2 2
3 on: 3 on:
4 push: 4 push:
5 - branches:  
6 - - wheel  
7 tags: 5 tags:
8 - '*' 6 - '*'
9 workflow_dispatch: 7 workflow_dispatch:
@@ -42,8 +42,6 @@ jobs: @@ -42,8 +42,6 @@ jobs:
42 run: | 42 run: |
43 ls -lh ./wheelhouse/ 43 ls -lh ./wheelhouse/
44 44
45 - ls -lh ./wheelhouse/*.whl  
46 -  
47 - uses: actions/upload-artifact@v4 45 - uses: actions/upload-artifact@v4
48 with: 46 with:
49 name: wheel-${{ matrix.python-version }} 47 name: wheel-${{ matrix.python-version }}
@@ -4,11 +4,25 @@ on: @@ -4,11 +4,25 @@ on:
4 push: 4 push:
5 branches: 5 branches:
6 - master 6 - master
7 - - xcframework  
8 paths: 7 paths:
9 - './build-ios.sh' 8 - './build-ios.sh'
  9 + - '.github/workflows/build-xcframework.yaml'
  10 + - 'CMakeLists.txt'
  11 + - 'cmake/**'
  12 + - 'sherpa-onnx/csrc/*'
  13 + - 'sherpa-onnx/c-api/*'
10 tags: 14 tags:
11 - '*' 15 - '*'
  16 + pull_request:
  17 + branches:
  18 + - master
  19 + paths:
  20 + - './build-ios.sh'
  21 + - '.github/workflows/build-xcframework.yaml'
  22 + - 'CMakeLists.txt'
  23 + - 'cmake/**'
  24 + - 'sherpa-onnx/csrc/*'
  25 + - 'sherpa-onnx/c-api/*'
12 26
13 workflow_dispatch: 27 workflow_dispatch:
14 28
@@ -50,7 +50,8 @@ jobs: @@ -50,7 +50,8 @@ jobs:
50 fail-fast: false 50 fail-fast: false
51 matrix: 51 matrix:
52 os: [ubuntu-latest] 52 os: [ubuntu-latest]
53 - build_type: [Release, Debug] 53 + # build_type: [Release, Debug]
  54 + build_type: [Release]
54 55
55 steps: 56 steps:
56 - uses: actions/checkout@v4 57 - uses: actions/checkout@v4
@@ -18,6 +18,7 @@ on: @@ -18,6 +18,7 @@ on:
18 - 'CMakeLists.txt' 18 - 'CMakeLists.txt'
19 - 'cmake/**' 19 - 'cmake/**'
20 - 'sherpa-onnx/csrc/*' 20 - 'sherpa-onnx/csrc/*'
  21 + - 'sherpa-onnx/c-api/*'
21 pull_request: 22 pull_request:
22 branches: 23 branches:
23 - master 24 - master
@@ -33,6 +34,7 @@ on: @@ -33,6 +34,7 @@ on:
33 - 'CMakeLists.txt' 34 - 'CMakeLists.txt'
34 - 'cmake/**' 35 - 'cmake/**'
35 - 'sherpa-onnx/csrc/*' 36 - 'sherpa-onnx/csrc/*'
  37 + - 'sherpa-onnx/c-api/*'
36 38
37 workflow_dispatch: 39 workflow_dispatch:
38 40
@@ -12,6 +12,7 @@ on: @@ -12,6 +12,7 @@ on:
12 - 'cmake/**' 12 - 'cmake/**'
13 - 'mfc-examples/**' 13 - 'mfc-examples/**'
14 - 'sherpa-onnx/csrc/*' 14 - 'sherpa-onnx/csrc/*'
  15 + - 'sherpa-onnx/c-api/*'
15 pull_request: 16 pull_request:
16 branches: 17 branches:
17 - master 18 - master
@@ -21,6 +22,7 @@ on: @@ -21,6 +22,7 @@ on:
21 - 'cmake/**' 22 - 'cmake/**'
22 - 'mfc-examples/**' 23 - 'mfc-examples/**'
23 - 'sherpa-onnx/csrc/*' 24 - 'sherpa-onnx/csrc/*'
  25 + - 'sherpa-onnx/c-api/*'
24 26
25 workflow_dispatch: 27 workflow_dispatch:
26 28
1 name: nightly-wheel-arm 1 name: nightly-wheel-arm
2 2
3 on: 3 on:
4 - push:  
5 - branches:  
6 - - master  
7 - - nightly  
8 schedule: 4 schedule:
9 # minute (0-59) 5 # minute (0-59)
10 # hour (0-23) 6 # hour (0-23)
@@ -9,6 +9,7 @@ on: @@ -9,6 +9,7 @@ on:
9 - 'CMakeLists.txt' 9 - 'CMakeLists.txt'
10 - 'cmake/**' 10 - 'cmake/**'
11 - 'sherpa-onnx/csrc/*' 11 - 'sherpa-onnx/csrc/*'
  12 + - 'sherpa-onnx/c-api/*'
12 - 'toolchains/riscv64-linux-gnu.toolchain.cmake' 13 - 'toolchains/riscv64-linux-gnu.toolchain.cmake'
13 - 'build-riscv64-linux-gnu.sh' 14 - 'build-riscv64-linux-gnu.sh'
14 tags: 15 tags:
@@ -22,6 +23,7 @@ on: @@ -22,6 +23,7 @@ on:
22 - 'cmake/**' 23 - 'cmake/**'
23 - 'sherpa-onnx/csrc/*' 24 - 'sherpa-onnx/csrc/*'
24 - 'toolchains/riscv64-linux-gnu.toolchain.cmake' 25 - 'toolchains/riscv64-linux-gnu.toolchain.cmake'
  26 + - 'sherpa-onnx/c-api/*'
25 - 'build-riscv64-linux-gnu.sh' 27 - 'build-riscv64-linux-gnu.sh'
26 28
27 workflow_dispatch: 29 workflow_dispatch:
@@ -194,6 +196,8 @@ jobs: @@ -194,6 +196,8 @@ jobs:
194 dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-riscv64-${{ matrix.lib_type }} 196 dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-riscv64-${{ matrix.lib_type }}
195 mkdir $dst 197 mkdir $dst
196 198
  199 + cp -v $GITHUB_WORKSPACE/toolchain/sysroot/lib/ld-linux-riscv64xthead-lp64d.so.1 build-riscv64-linux-gnu/install/lib/
  200 +
197 ls -lh build-riscv64-linux-gnu/install/lib 201 ls -lh build-riscv64-linux-gnu/install/lib
198 202
199 cp -a build-riscv64-linux-gnu/install/bin $dst/ 203 cp -a build-riscv64-linux-gnu/install/bin $dst/
@@ -219,6 +223,39 @@ jobs: @@ -219,6 +223,39 @@ jobs:
219 name: sherpa-onnx-linux-riscv64-shared 223 name: sherpa-onnx-linux-riscv64-shared
220 path: sherpa-onnx-*linux-riscv64-shared.tar.bz2 224 path: sherpa-onnx-*linux-riscv64-shared.tar.bz2
221 225
  226 + # https://huggingface.co/docs/hub/spaces-github-actions
  227 + - name: Publish to huggingface
  228 + if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
  229 + env:
  230 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
  231 + uses: nick-fields/retry@v3
  232 + with:
  233 + max_attempts: 20
  234 + timeout_seconds: 200
  235 + shell: bash
  236 + command: |
  237 + git config --global user.email "csukuangfj@gmail.com"
  238 + git config --global user.name "Fangjun Kuang"
  239 +
  240 + rm -rf huggingface
  241 +
  242 + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
  243 +
  244 + cd huggingface
  245 + git lfs pull
  246 + mkdir -p riscv64
  247 +
  248 + cp -v ../sherpa-onnx-*-shared.tar.bz2 ./riscv64
  249 +
  250 + git status
  251 + git lfs track "*.bz2"
  252 +
  253 + git add .
  254 +
  255 + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-riscv64-shared.tar.bz2"
  256 +
  257 + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
  258 +
222 - uses: actions/upload-artifact@v4 259 - uses: actions/upload-artifact@v4
223 if: matrix.lib_type == 'shared' 260 if: matrix.lib_type == 'shared'
224 with: 261 with:
@@ -30,19 +30,25 @@ concurrency: @@ -30,19 +30,25 @@ concurrency:
30 permissions: 30 permissions:
31 contents: read 31 contents: read
32 32
  33 +env:
  34 + SCCACHE_GHA_ENABLED: "true"
  35 +
33 jobs: 36 jobs:
34 run-python-test: 37 run-python-test:
  38 + name: ${{ matrix.os }} ${{ matrix.python-version }}
35 runs-on: ${{ matrix.os }} 39 runs-on: ${{ matrix.os }}
36 strategy: 40 strategy:
37 fail-fast: false 41 fail-fast: false
38 matrix: 42 matrix:
39 - os: [ubuntu-latest, macos-latest] # windows-latest]  
40 - python-version: ["3.7", "3.8", "3.9", "3.10"] 43 + os: [ubuntu-latest, macos-latest, windows-latest]
  44 + python-version: ["3.7", "3.8", "3.9", "3.10","3.11", "3.12"]
41 exclude: 45 exclude:
42 - os: macos-latest 46 - os: macos-latest
43 python-version: "3.9" 47 python-version: "3.9"
44 - os: macos-latest 48 - os: macos-latest
45 python-version: "3.10" 49 python-version: "3.10"
  50 + # - os: windows-latest
  51 + # python-version: "3.12"
46 52
47 steps: 53 steps:
48 - uses: actions/checkout@v4 54 - uses: actions/checkout@v4
@@ -50,10 +56,17 @@ jobs: @@ -50,10 +56,17 @@ jobs:
50 fetch-depth: 0 56 fetch-depth: 0
51 57
52 - name: ccache 58 - name: ccache
  59 + if: matrix.os != 'windows-latest'
53 uses: hendrikmuhs/ccache-action@v1.2 60 uses: hendrikmuhs/ccache-action@v1.2
54 with: 61 with:
55 key: ${{ matrix.os }}-python-${{ matrix.python-version }} 62 key: ${{ matrix.os }}-python-${{ matrix.python-version }}
56 63
  64 + - name: Run sccache-cache
  65 + if: matrix.os == 'windows-latest'
  66 + uses: mozilla-actions/sccache-action@v0.0.3
  67 + with:
  68 + version: "v0.7.4"
  69 +
57 - name: Setup Python 70 - name: Setup Python
58 uses: actions/setup-python@v5 71 uses: actions/setup-python@v5
59 with: 72 with:
@@ -62,9 +75,10 @@ jobs: @@ -62,9 +75,10 @@ jobs:
62 - name: Install Python dependencies 75 - name: Install Python dependencies
63 shell: bash 76 shell: bash
64 run: | 77 run: |
65 - python3 -m pip install --upgrade pip numpy pypinyin sentencepiece==0.1.96 soundfile 78 + python3 -m pip install --upgrade pip numpy pypinyin sentencepiece>=0.1.96 soundfile
66 79
67 - name: Install sherpa-onnx 80 - name: Install sherpa-onnx
  81 + if: matrix.os != 'windows-latest'
68 shell: bash 82 shell: bash
69 run: | 83 run: |
70 export CMAKE_CXX_COMPILER_LAUNCHER=ccache 84 export CMAKE_CXX_COMPILER_LAUNCHER=ccache
@@ -73,11 +87,22 @@ jobs: @@ -73,11 +87,22 @@ jobs:
73 87
74 python3 -m pip install --verbose . 88 python3 -m pip install --verbose .
75 89
  90 + - name: Install sherpa-onnx
  91 + if: matrix.os == 'windows-latest'
  92 + shell: bash
  93 + run: |
  94 + cmake --version
  95 + export SHERPA_ONNX_CMAKE_ARGS="-DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache"
  96 + echo "SHERPA_ONNX_CMAKE_ARGS: ${SHERPA_ONNX_CMAKE_ARGS}"
  97 +
  98 + python3 -m pip install --verbose .
  99 +
76 - name: Test sherpa-onnx 100 - name: Test sherpa-onnx
77 shell: bash 101 shell: bash
78 run: | 102 run: |
79 - .github/scripts/test-speaker-recognition-python.sh 103 + export OS=${{ matrix.os }}
80 .github/scripts/test-python.sh 104 .github/scripts/test-python.sh
  105 + .github/scripts/test-speaker-recognition-python.sh
81 106
82 - uses: actions/upload-artifact@v4 107 - uses: actions/upload-artifact@v4
83 with: 108 with:
@@ -4,10 +4,28 @@ on: @@ -4,10 +4,28 @@ on:
4 push: 4 push:
5 branches: 5 branches:
6 - master 6 - master
  7 + paths:
  8 + - './build-swift-macos.sh'
  9 + - '.github/workflows/swift.yaml'
  10 + - 'CMakeLists.txt'
  11 + - 'cmake/**'
  12 + - 'swift-api-examples/**'
  13 + - 'sherpa-onnx/csrc/*'
  14 + - 'sherpa-onnx/c-api/**'
  15 + - '.github/scripts/test-swift.sh'
7 16
8 pull_request: 17 pull_request:
9 branches: 18 branches:
10 - master 19 - master
  20 + paths:
  21 + - './build-swift-macos.sh'
  22 + - '.github/workflows/swift.yaml'
  23 + - 'CMakeLists.txt'
  24 + - 'cmake/**'
  25 + - 'swift-api-examples/**'
  26 + - 'sherpa-onnx/csrc/*'
  27 + - 'sherpa-onnx/c-api/**'
  28 + - '.github/scripts/test-swift.sh'
11 29
12 workflow_dispatch: 30 workflow_dispatch:
13 31
@@ -4,8 +4,23 @@ on: @@ -4,8 +4,23 @@ on:
4 push: 4 push:
5 branches: 5 branches:
6 - master 6 - master
7 - 7 + paths:
  8 + - 'setup.py'
  9 + - '.github/workflows/test-build-wheel.yaml'
  10 + - 'CMakeLists.txt'
  11 + - 'cmake/**'
  12 + - 'sherpa-onnx/csrc/*'
  13 + - 'sherpa-onnx/python/**'
8 pull_request: 14 pull_request:
  15 + branches:
  16 + - master
  17 + paths:
  18 + - 'setup.py'
  19 + - '.github/workflows/test-build-wheel.yaml'
  20 + - 'CMakeLists.txt'
  21 + - 'cmake/**'
  22 + - 'sherpa-onnx/csrc/*'
  23 + - 'sherpa-onnx/python/**'
9 24
10 workflow_dispatch: 25 workflow_dispatch:
11 26
@@ -15,13 +30,13 @@ concurrency: @@ -15,13 +30,13 @@ concurrency:
15 30
16 jobs: 31 jobs:
17 test-build-wheel: 32 test-build-wheel:
18 - name: ${{ matrix.os }} ${{ matrix.python_version }} 33 + name: ${{ matrix.os }} ${{ matrix.python-version }}
19 runs-on: ${{ matrix.os }} 34 runs-on: ${{ matrix.os }}
20 strategy: 35 strategy:
21 fail-fast: false 36 fail-fast: false
22 matrix: 37 matrix:
23 os: [ubuntu-latest, macos-latest, windows-latest] 38 os: [ubuntu-latest, macos-latest, windows-latest]
24 - python-version: ["3.8", "3.9", "3.10", "3.11"] 39 + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
25 40
26 steps: 41 steps:
27 - uses: actions/checkout@v4 42 - uses: actions/checkout@v4
@@ -75,6 +90,7 @@ jobs: @@ -75,6 +90,7 @@ jobs:
75 export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH 90 export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH
76 export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH 91 export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH
77 export PATH=/c/hostedtoolcache/windows/Python/3.11.8/x64/bin:$PATH 92 export PATH=/c/hostedtoolcache/windows/Python/3.11.8/x64/bin:$PATH
  93 + export PATH=/c/hostedtoolcache/windows/Python/3.12.2/x64/bin:$PATH
78 94
79 which sherpa-onnx 95 which sherpa-onnx
80 sherpa-onnx --help 96 sherpa-onnx --help
@@ -4,10 +4,24 @@ on: @@ -4,10 +4,24 @@ on:
4 push: 4 push:
5 branches: 5 branches:
6 - master 6 - master
  7 + paths:
  8 + - '.github/workflows/test-dot-net.yaml'
  9 + - 'CMakeLists.txt'
  10 + - 'cmake/**'
  11 + - 'sherpa-onnx/csrc/*'
  12 + - 'dotnet-examples/**'
  13 + - 'scripts/dotnet/**'
7 14
8 pull_request: 15 pull_request:
9 branches: 16 branches:
10 - master 17 - master
  18 + paths:
  19 + - '.github/workflows/test-dot-net.yaml'
  20 + - 'CMakeLists.txt'
  21 + - 'cmake/**'
  22 + - 'sherpa-onnx/csrc/*'
  23 + - 'dotnet-examples/**'
  24 + - 'scripts/dotnet/**'
11 25
12 workflow_dispatch: 26 workflow_dispatch:
13 27
@@ -4,9 +4,23 @@ on: @@ -4,9 +4,23 @@ on:
4 push: 4 push:
5 branches: 5 branches:
6 - master 6 - master
  7 + paths:
  8 + - '.github/workflows/test-go.yaml'
  9 + - 'CMakeLists.txt'
  10 + - 'cmake/**'
  11 + - 'sherpa-onnx/csrc/*'
  12 + - 'go-api-examples/**'
  13 + - 'scripts/go/**'
7 pull_request: 14 pull_request:
8 branches: 15 branches:
9 - master 16 - master
  17 + paths:
  18 + - '.github/workflows/test-go.yaml'
  19 + - 'CMakeLists.txt'
  20 + - 'cmake/**'
  21 + - 'sherpa-onnx/csrc/*'
  22 + - 'go-api-examples/**'
  23 + - 'scripts/go/**'
10 24
11 workflow_dispatch: 25 workflow_dispatch:
12 26
@@ -4,10 +4,26 @@ on: @@ -4,10 +4,26 @@ on:
4 push: 4 push:
5 branches: 5 branches:
6 - master 6 - master
  7 + paths:
  8 + - '.github/workflows/test-nodejs.yaml'
  9 + - 'CMakeLists.txt'
  10 + - 'cmake/**'
  11 + - 'sherpa-onnx/csrc/*'
  12 + - 'sherpa-onnx/c-api/*'
  13 + - 'scripts/nodejs/**'
  14 + - 'nodejs-examples/**'
7 15
8 pull_request: 16 pull_request:
9 branches: 17 branches:
10 - master 18 - master
  19 + paths:
  20 + - '.github/workflows/test-nodejs.yaml'
  21 + - 'CMakeLists.txt'
  22 + - 'cmake/**'
  23 + - 'sherpa-onnx/csrc/*'
  24 + - 'sherpa-onnx/c-api/*'
  25 + - 'scripts/nodejs/**'
  26 + - 'nodejs-examples/**'
11 27
12 workflow_dispatch: 28 workflow_dispatch:
13 29
@@ -29,7 +29,7 @@ jobs: @@ -29,7 +29,7 @@ jobs:
29 fail-fast: false 29 fail-fast: false
30 matrix: 30 matrix:
31 os: [ubuntu-latest, windows-latest, macos-latest] 31 os: [ubuntu-latest, windows-latest, macos-latest]
32 - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] 32 + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
33 exclude: 33 exclude:
34 - os: macos-latest 34 - os: macos-latest
35 python-version: "3.7" 35 python-version: "3.7"
@@ -68,6 +68,7 @@ jobs: @@ -68,6 +68,7 @@ jobs:
68 export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH 68 export PATH=/c/hostedtoolcache/windows/Python/3.9.13/x64/bin:$PATH
69 export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH 69 export PATH=/c/hostedtoolcache/windows/Python/3.10.11/x64/bin:$PATH
70 export PATH=/c/hostedtoolcache/windows/Python/3.11.8/x64/bin:$PATH 70 export PATH=/c/hostedtoolcache/windows/Python/3.11.8/x64/bin:$PATH
  71 + export PATH=/c/hostedtoolcache/windows/Python/3.12.2/x64/bin:$PATH
71 72
72 sherpa-onnx --help 73 sherpa-onnx --help
73 sherpa-onnx-keyword-spotter --help 74 sherpa-onnx-keyword-spotter --help
@@ -3,6 +3,19 @@ on: @@ -3,6 +3,19 @@ on:
3 push: 3 push:
4 branches: 4 branches:
5 - master 5 - master
  6 + paths:
  7 + - '.github/workflows/test-piper-phonemize.yaml'
  8 + - 'CMakeLists.txt'
  9 + - 'cmake/**'
  10 + - 'sherpa-onnx/csrc/*'
  11 + pull_request:
  12 + branches:
  13 + - master
  14 + paths:
  15 + - '.github/workflows/test-piper-phonemize.yaml'
  16 + - 'CMakeLists.txt'
  17 + - 'cmake/**'
  18 + - 'sherpa-onnx/csrc/*'
6 19
7 workflow_dispatch: 20 workflow_dispatch:
8 21
@@ -10,7 +23,6 @@ concurrency: @@ -10,7 +23,6 @@ concurrency:
10 group: test-piper-phonemize-${{ github.ref }} 23 group: test-piper-phonemize-${{ github.ref }}
11 cancel-in-progress: true 24 cancel-in-progress: true
12 25
13 -  
14 jobs: 26 jobs:
15 test_piper_phonemize: 27 test_piper_phonemize:
16 name: ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.shared_lib }} 28 name: ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.shared_lib }}
@@ -4,9 +4,21 @@ on: @@ -4,9 +4,21 @@ on:
4 push: 4 push:
5 branches: 5 branches:
6 - master 6 - master
  7 + paths:
  8 + - '.github/workflows/test-python-offline-websocket-server.yaml'
  9 + - 'CMakeLists.txt'
  10 + - 'cmake/**'
  11 + - 'sherpa-onnx/csrc/*'
  12 + - 'sherpa-onnx/python/**'
7 pull_request: 13 pull_request:
8 branches: 14 branches:
9 - master 15 - master
  16 + paths:
  17 + - '.github/workflows/test-python-offline-websocket-server.yaml'
  18 + - 'CMakeLists.txt'
  19 + - 'cmake/**'
  20 + - 'sherpa-onnx/csrc/*'
  21 + - 'sherpa-onnx/python/**'
10 workflow_dispatch: 22 workflow_dispatch:
11 23
12 concurrency: 24 concurrency:
@@ -4,9 +4,21 @@ on: @@ -4,9 +4,21 @@ on:
4 push: 4 push:
5 branches: 5 branches:
6 - master 6 - master
  7 + paths:
  8 + - '.github/workflows/test-python-online-websocket-server.yaml'
  9 + - 'CMakeLists.txt'
  10 + - 'cmake/**'
  11 + - 'sherpa-onnx/csrc/*'
  12 + - 'sherpa-onnx/python/**'
7 pull_request: 13 pull_request:
8 branches: 14 branches:
9 - master 15 - master
  16 + paths:
  17 + - '.github/workflows/test-python-online-websocket-server.yaml'
  18 + - 'CMakeLists.txt'
  19 + - 'cmake/**'
  20 + - 'sherpa-onnx/csrc/*'
  21 + - 'sherpa-onnx/python/**'
10 workflow_dispatch: 22 workflow_dispatch:
11 23
12 concurrency: 24 concurrency:
@@ -40,7 +40,7 @@ concurrency: @@ -40,7 +40,7 @@ concurrency:
40 40
41 jobs: 41 jobs:
42 windows_x64: 42 windows_x64:
43 - name: Windows x64 43 + name: ${{ matrix.shared_lib }}
44 runs-on: ${{ matrix.os }} 44 runs-on: ${{ matrix.os }}
45 strategy: 45 strategy:
46 fail-fast: false 46 fail-fast: false
@@ -59,7 +59,6 @@ jobs: @@ -59,7 +59,6 @@ jobs:
59 mkdir build 59 mkdir build
60 cd build 60 cd build
61 cmake -A x64 -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install .. 61 cmake -A x64 -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install ..
62 -  
63 - name: Build sherpa-onnx for windows 62 - name: Build sherpa-onnx for windows
64 shell: bash 63 shell: bash
65 run: | 64 run: |
@@ -134,12 +133,17 @@ jobs: @@ -134,12 +133,17 @@ jobs:
134 .github/scripts/test-online-transducer.sh 133 .github/scripts/test-online-transducer.sh
135 134
136 - name: Copy files 135 - name: Copy files
137 - if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')  
138 shell: bash 136 shell: bash
139 run: | 137 run: |
140 SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) 138 SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
141 139
142 - dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64 140 + shared_lib=${{ matrix.shared_lib }}
  141 + if [[ $shared_lib == "ON" ]]; then
  142 + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-shared
  143 + else
  144 + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-static
  145 + fi
  146 +
143 mkdir $dst 147 mkdir $dst
144 148
145 cp -a build/install/bin $dst/ 149 cp -a build/install/bin $dst/
@@ -148,10 +152,42 @@ jobs: @@ -148,10 +152,42 @@ jobs:
148 152
149 tar cjvf ${dst}.tar.bz2 $dst 153 tar cjvf ${dst}.tar.bz2 $dst
150 154
  155 + # https://huggingface.co/docs/hub/spaces-github-actions
  156 + - name: Publish to huggingface
  157 + if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
  158 + env:
  159 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
  160 + uses: nick-fields/retry@v3
  161 + with:
  162 + max_attempts: 20
  163 + timeout_seconds: 200
  164 + shell: bash
  165 + command: |
  166 + git config --global user.email "csukuangfj@gmail.com"
  167 + git config --global user.name "Fangjun Kuang"
  168 +
  169 + rm -rf huggingface
  170 + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
  171 +
  172 + cd huggingface
  173 + git lfs pull
  174 + mkdir -p win64
  175 +
  176 + cp -v ../sherpa-onnx-*.tar.bz2 ./win64
  177 +
  178 + git status
  179 + git lfs track "*.bz2"
  180 +
  181 + git add .
  182 +
  183 + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}"
  184 +
  185 + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
  186 +
151 - name: Release pre-compiled binaries and libs for Windows x64 187 - name: Release pre-compiled binaries and libs for Windows x64
152 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') 188 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
153 uses: svenstaro/upload-release-action@v2 189 uses: svenstaro/upload-release-action@v2
154 with: 190 with:
155 file_glob: true 191 file_glob: true
156 overwrite: true 192 overwrite: true
157 - file: sherpa-onnx-*-win-x64.tar.bz2 193 + file: sherpa-onnx-*-win-x64*.tar.bz2
@@ -134,12 +134,19 @@ jobs: @@ -134,12 +134,19 @@ jobs:
134 .github/scripts/test-online-transducer.sh 134 .github/scripts/test-online-transducer.sh
135 135
136 - name: Copy files 136 - name: Copy files
137 - if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')  
138 shell: bash 137 shell: bash
139 run: | 138 run: |
140 SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) 139 SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
141 140
142 dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86 141 dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86
  142 +
  143 + shared_lib=${{ matrix.shared_lib }}
  144 + if [[ $shared_lib == "ON" ]]; then
  145 + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-shared
  146 + else
  147 + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-static
  148 + fi
  149 +
143 mkdir $dst 150 mkdir $dst
144 151
145 cp -a build/install/bin $dst/ 152 cp -a build/install/bin $dst/
@@ -148,10 +155,42 @@ jobs: @@ -148,10 +155,42 @@ jobs:
148 155
149 tar cjvf ${dst}.tar.bz2 $dst 156 tar cjvf ${dst}.tar.bz2 $dst
150 157
  158 + # https://huggingface.co/docs/hub/spaces-github-actions
  159 + - name: Publish to huggingface
  160 + if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa'
  161 + env:
  162 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
  163 + uses: nick-fields/retry@v3
  164 + with:
  165 + max_attempts: 20
  166 + timeout_seconds: 200
  167 + shell: bash
  168 + command: |
  169 + git config --global user.email "csukuangfj@gmail.com"
  170 + git config --global user.name "Fangjun Kuang"
  171 +
  172 + rm -rf huggingface
  173 + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
  174 +
  175 + cd huggingface
  176 + git lfs pull
  177 + mkdir -p win32
  178 +
  179 + cp -v ../sherpa-onnx-*.tar.bz2 ./win32
  180 +
  181 + git status
  182 + git lfs track "*.bz2"
  183 +
  184 + git add .
  185 +
  186 + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}"
  187 +
  188 + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
  189 +
151 - name: Release pre-compiled binaries and libs for Windows x86 190 - name: Release pre-compiled binaries and libs for Windows x86
152 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') 191 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
153 uses: svenstaro/upload-release-action@v2 192 uses: svenstaro/upload-release-action@v2
154 with: 193 with:
155 file_glob: true 194 file_glob: true
156 overwrite: true 195 overwrite: true
157 - file: sherpa-onnx-*-win-x86.tar.bz2 196 + file: sherpa-onnx-*-win-x86*.tar.bz2
@@ -68,6 +68,12 @@ class OfflineDecodeFiles @@ -68,6 +68,12 @@ class OfflineDecodeFiles
68 It specifies number of active paths to keep during the search")] 68 It specifies number of active paths to keep during the search")]
69 public int MaxActivePaths { get; set; } 69 public int MaxActivePaths { get; set; }
70 70
  71 + [Option("hotwords-file", Required = false, Default = "", HelpText = "Path to hotwords.txt")]
  72 + public string HotwordsFile { get; set; }
  73 +
  74 + [Option("hotwords-score", Required = false, Default = 1.5F, HelpText = "hotwords score")]
  75 + public float HotwordsScore { get; set; }
  76 +
71 [Option("files", Required = true, HelpText = "Audio files for decoding")] 77 [Option("files", Required = true, HelpText = "Audio files for decoding")]
72 public IEnumerable<string> Files { get; set; } 78 public IEnumerable<string> Files { get; set; }
73 } 79 }
@@ -214,6 +220,9 @@ to download pre-trained Tdnn models. @@ -214,6 +220,9 @@ to download pre-trained Tdnn models.
214 220
215 config.DecodingMethod = options.DecodingMethod; 221 config.DecodingMethod = options.DecodingMethod;
216 config.MaxActivePaths = options.MaxActivePaths; 222 config.MaxActivePaths = options.MaxActivePaths;
  223 + config.HotwordsFile = options.HotwordsFile;
  224 + config.HotwordsScore = options.HotwordsScore;
  225 +
217 config.ModelConfig.Debug = 0; 226 config.ModelConfig.Debug = 0;
218 227
219 OfflineRecognizer recognizer = new OfflineRecognizer(config); 228 OfflineRecognizer recognizer = new OfflineRecognizer(config);
@@ -79,6 +79,13 @@ only when --enable-endpoint is true.")] @@ -79,6 +79,13 @@ only when --enable-endpoint is true.")]
79 larger than this value. Used only when --enable-endpoint is true.")] 79 larger than this value. Used only when --enable-endpoint is true.")]
80 public float Rule3MinUtteranceLength { get; set; } 80 public float Rule3MinUtteranceLength { get; set; }
81 81
  82 + [Option("hotwords-file", Required = false, Default = "", HelpText = "Path to hotwords.txt")]
  83 + public string HotwordsFile { get; set; }
  84 +
  85 + [Option("hotwords-score", Required = false, Default = 1.5F, HelpText = "hotwords score")]
  86 + public float HotwordsScore { get; set; }
  87 +
  88 +
82 [Option("files", Required = true, HelpText = "Audio files for decoding")] 89 [Option("files", Required = true, HelpText = "Audio files for decoding")]
83 public IEnumerable<string> Files { get; set; } 90 public IEnumerable<string> Files { get; set; }
84 91
@@ -180,6 +187,8 @@ to download pre-trained streaming models. @@ -180,6 +187,8 @@ to download pre-trained streaming models.
180 config.Rule1MinTrailingSilence = options.Rule1MinTrailingSilence; 187 config.Rule1MinTrailingSilence = options.Rule1MinTrailingSilence;
181 config.Rule2MinTrailingSilence = options.Rule2MinTrailingSilence; 188 config.Rule2MinTrailingSilence = options.Rule2MinTrailingSilence;
182 config.Rule3MinUtteranceLength = options.Rule3MinUtteranceLength; 189 config.Rule3MinUtteranceLength = options.Rule3MinUtteranceLength;
  190 + config.HotwordsFile = options.HotwordsFile;
  191 + config.HotwordsScore = options.HotwordsScore;
183 192
184 OnlineRecognizer recognizer = new OnlineRecognizer(config); 193 OnlineRecognizer recognizer = new OnlineRecognizer(config);
185 194
@@ -2,4 +2,6 @@ all @@ -2,4 +2,6 @@ all
2 macos 2 macos
3 linux 3 linux
4 windows 4 windows
  5 +windows-x64
  6 +windows-x86
5 packages 7 packages
@@ -130,7 +130,7 @@ namespace SherpaOnnx @@ -130,7 +130,7 @@ namespace SherpaOnnx
130 Rule2MinTrailingSilence = 2.4F; 130 Rule2MinTrailingSilence = 2.4F;
131 Rule3MinUtteranceLength = 20.0F; 131 Rule3MinUtteranceLength = 20.0F;
132 HotwordsFile = ""; 132 HotwordsFile = "";
133 - HotwordsScore = 2F; 133 + HotwordsScore = 1.5F;
134 } 134 }
135 public FeatureConfig FeatConfig; 135 public FeatureConfig FeatConfig;
136 public OnlineModelConfig ModelConfig; 136 public OnlineModelConfig ModelConfig;