Skip to content

Commit 25a545f

Browse files
csukuangfjYour Name
authored and
Your Name
committed
Add CI for non-streaming zipformer about ksponspeech (k2-fsa#1667)
1 parent 18729f1 commit 25a545f

File tree

2 files changed

+118
-9
lines changed

2 files changed

+118
-9
lines changed

.github/scripts/ksponspeech/ASR/run.sh

+63-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,66 @@ log() {
1111
cd egs/ksponspeech/ASR
1212

1313

14-
function test_pretrained() {
14+
function test_pretrained_non_streaming() {
15+
git lfs install
16+
git clone https://huggingface.co/johnBamma/icefall-asr-ksponspeech-zipformer-2024-06-24
17+
repo=icefall-asr-ksponspeech-zipformer-2024-06-24
18+
pushd $repo
19+
mkdir test_wavs
20+
cd test_wavs
21+
curl -SL -O https://huggingface.co/k2-fsa/sherpa-onnx-streaming-zipformer-korean-2024-06-16/resolve/main/test_wavs/0.wav
22+
curl -SL -O https://huggingface.co/k2-fsa/sherpa-onnx-streaming-zipformer-korean-2024-06-16/resolve/main/test_wavs/1.wav
23+
curl -SL -O https://huggingface.co/k2-fsa/sherpa-onnx-streaming-zipformer-korean-2024-06-16/resolve/main/test_wavs/2.wav
24+
curl -SL -O https://huggingface.co/k2-fsa/sherpa-onnx-streaming-zipformer-korean-2024-06-16/resolve/main/test_wavs/3.wav
25+
curl -SL -O https://huggingface.co/k2-fsa/sherpa-onnx-streaming-zipformer-korean-2024-06-16/resolve/main/test_wavs/trans.txt
26+
cd ../exp
27+
ln -s pretrained.pt epoch-99.pt
28+
ls -lh
29+
popd
30+
31+
log 'test pretrained.py'
32+
./zipformer/pretrained.py \
33+
--checkpoint $repo/exp/pretrained.pt \
34+
--tokens $repo/data/lang_bpe_5000/tokens.txt \
35+
--method greedy_search \
36+
$repo/test_wavs/0.wav \
37+
$repo/test_wavs/1.wav \
38+
$repo/test_wavs/2.wav \
39+
$repo/test_wavs/3.wav
40+
41+
log 'test export-onnx.py'
42+
43+
./zipformer/export-onnx.py \
44+
--tokens $repo/data/lang_bpe_5000/tokens.txt \
45+
--use-averaged-model 0 \
46+
--epoch 99 \
47+
--avg 1 \
48+
--exp-dir $repo/exp/
49+
50+
ls -lh $repo/exp
51+
52+
ls -lh $repo/data/lang_bpe_5000/
53+
54+
log 'test exported onnx models'
55+
./zipformer/onnx_pretrained.py \
56+
--encoder-model-filename $repo/exp/encoder-epoch-99-avg-1.onnx \
57+
--decoder-model-filename $repo/exp/decoder-epoch-99-avg-1.onnx \
58+
--joiner-model-filename $repo/exp/joiner-epoch-99-avg-1.onnx \
59+
--tokens $repo/data/lang_bpe_5000/tokens.txt \
60+
$repo/test_wavs/0.wav
61+
62+
dst=/tmp/model-2024-06-24
63+
mkdir -p $dst
64+
65+
cp -av $repo/test_wavs $dst
66+
cp -v $repo/exp/*.onnx $dst
67+
cp -v $repo/exp/*.onnx $dst
68+
cp -v $repo/data/lang_bpe_5000/tokens.txt $dst
69+
cp -v $repo/data/lang_bpe_5000/bpe.model $dst
70+
rm -rf $repo
71+
}
72+
73+
function test_pretrained_streaming() {
1574
git lfs install
1675
git clone https://huggingface.co/johnBamma/icefall-asr-ksponspeech-pruned-transducer-stateless7-streaming-2024-06-12
1776
repo=icefall-asr-ksponspeech-pruned-transducer-stateless7-streaming-2024-06-12
@@ -59,7 +118,7 @@ function test_pretrained() {
59118
--tokens $repo/data/lang_bpe_5000/tokens.txt \
60119
$repo/test_wavs/0.wav
61120

62-
dst=/tmp/model1
121+
dst=/tmp/model-2024-06-16
63122
mkdir -p $dst
64123

65124
cp -v $repo/exp/*.onnx $dst
@@ -69,4 +128,5 @@ function test_pretrained() {
69128
rm -rf $repo
70129
}
71130

72-
test_pretrained
131+
test_pretrained_non_streaming
132+
test_pretrained_streaming

.github/workflows/ksponspeech.yml

+55-6
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,19 @@ jobs:
5757
5858
.github/scripts/ksponspeech/ASR/run.sh
5959
60-
- name: Show model files
60+
- name: Show model files (2024-06-24)
6161
shell: bash
6262
run: |
63-
src=/tmp/model1
63+
src=/tmp/model-2024-06-24
6464
ls -lh $src
6565
66-
- name: Upload model to huggingface
66+
- name: Show model files (2024-06-16)
67+
shell: bash
68+
run: |
69+
src=/tmp/model-2024-06-16
70+
ls -lh $src
71+
72+
- name: Upload model to huggingface (2024-06-24)
6773
env:
6874
HF_TOKEN: ${{ secrets.HF_TOKEN }}
6975
uses: nick-fields/retry@v3
@@ -72,7 +78,41 @@ jobs:
7278
timeout_seconds: 200
7379
shell: bash
7480
command: |
75-
src=/tmp/model1
81+
src=/tmp/model-2024-06-24
82+
git config --global user.email "csukuangfj@gmail.com"
83+
git config --global user.name "Fangjun Kuang"
84+
85+
rm -rf hf
86+
export GIT_LFS_SKIP_SMUDGE=1
87+
export GIT_CLONE_PROTECTION_ACTIVE=false
88+
89+
git clone https://huggingface.co/k2-fsa/sherpa-onnx-zipformer-korean-2024-06-24 hf
90+
cd hf
91+
git fetch
92+
git pull
93+
git merge -m "merge remote" --ff origin main
94+
cp -av $src/* ./
95+
ls -lh
96+
git lfs track "bpe.model"
97+
git lfs track "*.onnx"
98+
git add .
99+
git status
100+
git commit -m "update models"
101+
git status
102+
103+
git push https://csukuangfj:$HF_TOKEN@huggingface.co/k2-fsa/sherpa-onnx-zipformer-korean-2024-06-24 main || true
104+
rm -rf hf
105+
106+
- name: Upload model to huggingface (2024-06-16)
107+
env:
108+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
109+
uses: nick-fields/retry@v3
110+
with:
111+
max_attempts: 20
112+
timeout_seconds: 200
113+
shell: bash
114+
command: |
115+
src=/tmp/model-2024-06-16
76116
git config --global user.email "csukuangfj@gmail.com"
77117
git config --global user.name "Fangjun Kuang"
78118
@@ -98,15 +138,24 @@ jobs:
98138
git push https://csukuangfj:$HF_TOKEN@huggingface.co/k2-fsa/sherpa-onnx-streaming-zipformer-korean-2024-06-16 main || true
99139
rm -rf hf
100140
101-
- name: Prepare for release
141+
- name: Prepare for release (2024-06-16)
102142
shell: bash
103143
run: |
104-
src=/tmp/model1
144+
src=/tmp/model-2024-06-16
105145
d=sherpa-onnx-streaming-zipformer-korean-2024-06-16
106146
mv $src ./$d
107147
tar cjvf ${d}.tar.bz2 $d
108148
ls -lh
109149
150+
- name: Prepare for release (2024-06-24)
151+
shell: bash
152+
run: |
153+
src=/tmp/model-2024-06-24
154+
d=sherpa-onnx-zipformer-korean-2024-06-24
155+
mv $src ./$d
156+
tar cjvf ${d}.tar.bz2 $d
157+
ls -lh
158+
110159
- name: Release exported onnx models
111160
uses: svenstaro/upload-release-action@v2
112161
with:

0 commit comments

Comments
 (0)