csukuangfj
commited on
Commit
•
3427bb1
1
Parent(s):
4165cbe
add scripts
Browse files- export-for-ncnn.sh +44 -0
export-for-ncnn.sh
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env bash
|
2 |
+
|
3 |
+
export CUDA_VISIBLE_DEVICES=""
|
4 |
+
|
5 |
+
set -ex
|
6 |
+
|
7 |
+
dir=./icefall-asr-conv-emformer-transducer-stateless2-zh
|
8 |
+
if [ ! -f $dir/exp/epoch-99.pt ]; then
|
9 |
+
pushd $dir/exp
|
10 |
+
ln -sv pretrained-epoch-11-avg-1.pt epoch-99.pt
|
11 |
+
popd
|
12 |
+
fi
|
13 |
+
|
14 |
+
./conv_emformer_transducer_stateless2/export-for-ncnn.py \
|
15 |
+
--exp-dir $dir/exp \
|
16 |
+
--lang-dir $dir/data/lang_char_bpe \
|
17 |
+
--epoch 99 \
|
18 |
+
--avg 1 \
|
19 |
+
--use-averaged-model 0 \
|
20 |
+
\
|
21 |
+
--num-encoder-layers 12 \
|
22 |
+
--chunk-length 32 \
|
23 |
+
--cnn-module-kernel 31 \
|
24 |
+
--left-context-length 32 \
|
25 |
+
--right-context-length 8 \
|
26 |
+
--memory-size 32
|
27 |
+
|
28 |
+
pushd $dir/exp
|
29 |
+
pnnx ./encoder_jit_trace-pnnx.pt
|
30 |
+
pnnx ./decoder_jit_trace-pnnx.pt
|
31 |
+
pnnx ./joiner_jit_trace-pnnx.pt
|
32 |
+
|
33 |
+
# Note: You have to change
|
34 |
+
|
35 |
+
# 7767517
|
36 |
+
# 1060 1342
|
37 |
+
# Input in0 0 1 in0
|
38 |
+
#
|
39 |
+
# to
|
40 |
+
#
|
41 |
+
# 7767517
|
42 |
+
# 1061 1342
|
43 |
+
# SherpaMetaData sherpa_meta_data1 0 0 0=1 1=12 2=32 3=31 4=8 5=32 6=8 7=512
|
44 |
+
# Input in0 0 1 in0
|