/
run.sh
executable file
·249 lines (192 loc) · 6.57 KB
/
run.sh
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
#!/usr/bin/env bash
#
# Copyright 2023 Xiaomi Corp. (authors: Fangjun Kuang)
#
# Please refer to
# https://github.com/wenet-e2e/wenet/blob/main/docs/pretrained_models.en.md
# for a table of pre-trained models.
# Please select the column "Checkpoint Model" for downloading.
set -ex
function install_dependencies() {
pip install soundfile
pip install torch==2.1.0+cpu torchaudio==2.1.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install k2==1.24.4.dev20231022+cpu.torch2.1.0 -f https://k2-fsa.github.io/k2/cpu.html
pip install onnxruntime onnx kaldi-native-fbank pyyaml
pip install git+https://github.com/wenet-e2e/wenet.git
wenet_dir=$(dirname $(python3 -c "import wenet; print(wenet.__file__)"))
git clone https://github.com/wenet-e2e/wenet
if [ ! -d $wenet_dir/transducer/search ]; then
cp -av ./wenet/wenet/transducer/search $wenet_dir/transducer
fi
if [ ! -d $wenet_dir/e_branchformer ]; then
cp -a .//wenet/wenet/e_branchformer $wenet_dir
fi
if [ ! -d $wenet_dir/ctl_model ]; then
cp -a ./wenet/wenet/ctl_model $wenet_dir
fi
rm -rf wenet
}
function aishell() {
echo "aishell"
wget -q https://huggingface.co/openspeech/wenet-models/resolve/main/aishell_u2pp_conformer_exp.tar.gz
tar xvf aishell_u2pp_conformer_exp.tar.gz
rm -v aishell_u2pp_conformer_exp.tar.gz
pushd aishell_u2pp_conformer_exp
mkdir -p exp/20210601_u2++_conformer_exp
cp global_cmvn ./exp/20210601_u2++_conformer_exp
cp ../*.py .
export WENET_URL=https://wenet.org.cn/downloads?models=wenet&version=aishell_u2pp_conformer_exp.tar.gz
wget -O 0.wav https://huggingface.co/openspeech/wenet-models/resolve/main/zh.wav
soxi 0.wav
echo "Test streaming"
./export-onnx-streaming.py
ls -lh
./test-onnx-streaming.py
echo "Test non-streaming"
./export-onnx.py
ls -lh
./test-onnx.py
cat > README.md <<EOF
# Introduction
This model is converted from https://wenet.org.cn/downloads?models=wenet&version=aishell_u2pp_conformer_exp.tar.gz
EOF
popd
}
function aishell2() {
echo "aishell2"
wget -q https://huggingface.co/openspeech/wenet-models/resolve/main/aishell2_u2pp_conformer_exp.tar.gz
tar xvf aishell2_u2pp_conformer_exp.tar.gz
rm -v aishell2_u2pp_conformer_exp.tar.gz
pushd aishell2_u2pp_conformer_exp
mkdir -p exp/u2++_conformer
cp global_cmvn ./exp/u2++_conformer
cp ../*.py .
export WENET_URL=https://wenet.org.cn/downloads?models=wenet&version=aishell2_u2pp_conformer_exp.tar.gz
wget -O 0.wav https://huggingface.co/openspeech/wenet-models/resolve/main/zh.wav
soxi 0.wav
echo "Test streaming"
./export-onnx-streaming.py
ls -lh
./test-onnx-streaming.py
echo "Test non-streaming"
./export-onnx.py
ls -lh
./test-onnx.py
cat > README.md <<EOF
# Introduction
This model is converted from https://wenet.org.cn/downloads?models=wenet&version=aishell2_u2pp_conformer_exp.tar.gz
EOF
popd
}
function multi_cn() {
echo "multi_cn"
wget -q https://huggingface.co/openspeech/wenet-models/resolve/main/multi_cn_unified_conformer_exp.tar.gz
tar xvf multi_cn_unified_conformer_exp.tar.gz
rm -v multi_cn_unified_conformer_exp.tar.gz
pushd multi_cn_unified_conformer_exp
mkdir -p exp/20210815_unified_conformer_exp
cp global_cmvn ./exp/20210815_unified_conformer_exp
cp ../*.py .
export WENET_URL=https://wenet.org.cn/downloads?models=wenet&version=multi_cn_unified_conformer_exp.tar.gz
wget -O 0.wav https://huggingface.co/openspeech/wenet-models/resolve/main/zh.wav
soxi 0.wav
echo "Test streaming"
./export-onnx-streaming.py
ls -lh
./test-onnx-streaming.py
echo "Test non-streaming"
./export-onnx.py
ls -lh
./test-onnx.py
cat > README.md <<EOF
# Introduction
This model is converted from https://wenet.org.cn/downloads?models=wenet&version=multi_cn_unified_conformer_exp.tar.gz
EOF
popd
}
function wenetspeech() {
echo "wenetspeech"
wget -q https://huggingface.co/openspeech/wenet-models/resolve/main/wenetspeech_u2pp_conformer_exp.tar.gz
tar xvf wenetspeech_u2pp_conformer_exp.tar.gz
rm -v wenetspeech_u2pp_conformer_exp.tar.gz
pushd 20220506_u2pp_conformer_exp
mkdir -p exp/20220506_u2pp_conformer_exp
cp global_cmvn ./exp/20220506_u2pp_conformer_exp
cp ../*.py .
export WENET_URL=https://wenet.org.cn/downloads?models=wenet&version=wenetspeech_u2pp_conformer_exp.tar.gz
wget -O 0.wav https://huggingface.co/openspeech/wenet-models/resolve/main/zh.wav
soxi 0.wav
echo "Test streaming"
./export-onnx-streaming.py
ls -lh
./test-onnx-streaming.py
echo "Test non-streaming"
./export-onnx.py
ls -lh
./test-onnx.py
cat > README.md <<EOF
# Introduction
This model is converted from https://wenet.org.cn/downloads?models=wenet&version=wenetspeech_u2pp_conformer_exp.tar.gz
EOF
popd
}
function librispeech() {
echo "librispeech"
wget -q https://huggingface.co/openspeech/wenet-models/resolve/main/librispeech_u2pp_conformer_exp.tar.gz
tar xvf librispeech_u2pp_conformer_exp.tar.gz
rm -v librispeech_u2pp_conformer_exp.tar.gz
pushd librispeech_u2pp_conformer_exp
mkdir -p data/train_960
cp global_cmvn ./data/train_960
cp ../*.py .
export WENET_URL=https://wenet.org.cn/downloads?models=wenet&version=librispeech_u2pp_conformer_exp.tar.gz
wget -O 0.wav https://huggingface.co/openspeech/wenet-models/resolve/main/en.wav
soxi 0.wav
echo "Test streaming"
./export-onnx-streaming.py
ls -lh
./test-onnx-streaming.py
echo "Test non-streaming"
./export-onnx.py
ls -lh
./test-onnx.py
cat > README.md <<EOF
# Introduction
This model is converted from https://wenet.org.cn/downloads?models=wenet&version=librispeech_u2pp_conformer_exp.tar.gz
EOF
popd
}
function gigaspeech() {
echo "gigaspeech"
wget -q https://huggingface.co/openspeech/wenet-models/resolve/main/gigaspeech_u2pp_conformer_exp.tar.gz
tar xvf gigaspeech_u2pp_conformer_exp.tar.gz
rm -v gigaspeech_u2pp_conformer_exp.tar.gz
pushd 20210728_u2pp_conformer_exp
mkdir -p data/gigaspeech_train_xl
cp global_cmvn ./data/gigaspeech_train_xl
cp ../*.py .
export WENET_URL=https://wenet.org.cn/downloads?models=wenet&version=gigaspeech_u2pp_conformer_exp.tar.gz
wget -O 0.wav https://huggingface.co/openspeech/wenet-models/resolve/main/en.wav
soxi 0.wav
echo "Test streaming"
./export-onnx-streaming.py
ls -lh
./test-onnx-streaming.py
echo "Test non-streaming"
./export-onnx.py
ls -lh
./test-onnx.py
cat > README.md <<EOF
# Introduction
This model is converted from https://wenet.org.cn/downloads?models=wenet&version=gigaspeech_u2pp_conformer_exp.tar.gz
EOF
popd
}
install_dependencies
aishell
aishell2
multi_cn
wenetspeech
librispeech
gigaspeech
tree .