@@ -42,11 +42,6 @@ echo "chunk mode ${chunk_mode}"
42
42
43
43
44
44
if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then
45
- # format the reference test file
46
- python utils/format_rsl.py \
47
- --origin_ref data/manifest.test.raw \
48
- --trans_ref data/manifest.test.text
49
-
50
45
for type in attention; do
51
46
echo " decoding ${type} "
52
47
if [ ${chunk_mode} == true ]; then
@@ -68,98 +63,55 @@ if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then
68
63
echo " Failed in evaluation!"
69
64
exit 1
70
65
fi
71
- # format the hyp file
72
- python utils/format_rsl.py \
73
- --origin_hyp ${ckpt_prefix} .${type} .rsl \
74
- --trans_hyp ${ckpt_prefix} .${type} .rsl.text
75
-
76
- python utils/compute-wer.py --char=1 --v=1 \
77
- data/manifest.test.text ${ckpt_prefix} .${type} .rsl.text > ${ckpt_prefix} .${type} .error
78
-
79
66
echo " decoding ${type} done."
80
67
done
81
68
fi
82
69
83
- if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
84
- for type in ctc_greedy_search; do
85
- echo " decoding ${type} "
86
- if [ ${chunk_mode} == true ]; then
87
- # stream decoding only support batchsize=1
88
- batch_size=1
89
- else
90
- batch_size=64
91
- fi
92
- python3 -u ${BIN_DIR} /test.py \
93
- --ngpu ${ngpu} \
94
- --config ${config_path} \
95
- --decode_cfg ${decode_config_path} \
96
- --result_file ${ckpt_prefix} .${type} .rsl \
97
- --checkpoint_path ${ckpt_prefix} \
98
- --opts decode.decoding_method ${type} \
99
- --opts decode.decode_batch_size ${batch_size}
100
-
101
- if [ $? -ne 0 ]; then
102
- echo " Failed in evaluation!"
103
- exit 1
104
- fi
105
-
106
- # format the hyp file
107
- python utils/format_rsl.py \
108
- --origin_hyp ${ckpt_prefix} .${type} .rsl \
109
- --trans_hyp ${ckpt_prefix} .${type} .rsl.text
110
-
111
- python utils/compute-wer.py --char=1 --v=1 \
112
- data/manifest.test.text ${ckpt_prefix} .${type} .rsl.text > ${ckpt_prefix} .${type} .error
113
-
114
- echo " decoding ${type} done."
115
- done
116
- fi
117
-
118
- if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
119
- for type in ctc_prefix_beam_search attention_rescoring; do
120
- echo " decoding ${type} "
70
+ for type in ctc_greedy_search; do
71
+ echo " decoding ${type} "
72
+ if [ ${chunk_mode} == true ]; then
73
+ # stream decoding only support batchsize=1
121
74
batch_size=1
122
- python3 -u ${BIN_DIR} /test.py \
123
- --ngpu ${ngpu} \
124
- --config ${config_path} \
125
- --decode_cfg ${decode_config_path} \
126
- --result_file ${ckpt_prefix} .${type} .rsl \
127
- --checkpoint_path ${ckpt_prefix} \
128
- --opts decode.decoding_method ${type} \
129
- --opts decode.decode_batch_size ${batch_size}
130
-
131
- if [ $? -ne 0 ]; then
132
- echo " Failed in evaluation!"
133
- exit 1
134
- fi
135
- # format the hyp file
136
- python utils/format_rsl.py \
137
- --origin_hyp ${ckpt_prefix} .${type} .rsl \
138
- --trans_hyp ${ckpt_prefix} .${type} .rsl.text
75
+ else
76
+ batch_size=64
77
+ fi
78
+ python3 -u ${BIN_DIR} /test.py \
79
+ --ngpu ${ngpu} \
80
+ --config ${config_path} \
81
+ --decode_cfg ${decode_config_path} \
82
+ --result_file ${ckpt_prefix} .${type} .rsl \
83
+ --checkpoint_path ${ckpt_prefix} \
84
+ --opts decode.decoding_method ${type} \
85
+ --opts decode.decode_batch_size ${batch_size}
86
+
87
+ if [ $? -ne 0 ]; then
88
+ echo " Failed in evaluation!"
89
+ exit 1
90
+ fi
91
+ echo " decoding ${type} done."
92
+ done
93
+
94
+
95
+
96
+ for type in ctc_prefix_beam_search attention_rescoring; do
97
+ echo " decoding ${type} "
98
+ batch_size=1
99
+ python3 -u ${BIN_DIR} /test.py \
100
+ --ngpu ${ngpu} \
101
+ --config ${config_path} \
102
+ --decode_cfg ${decode_config_path} \
103
+ --result_file ${ckpt_prefix} .${type} .rsl \
104
+ --checkpoint_path ${ckpt_prefix} \
105
+ --opts decode.decoding_method ${type} \
106
+ --opts decode.decode_batch_size ${batch_size}
107
+
108
+ if [ $? -ne 0 ]; then
109
+ echo " Failed in evaluation!"
110
+ exit 1
111
+ fi
112
+ echo " decoding ${type} done."
113
+ done
139
114
140
- python utils/compute-wer.py --char=1 --v=1 \
141
- data/manifest.test.text ${ckpt_prefix} .${type} .rsl.text > ${ckpt_prefix} .${type} .error
142
-
143
- echo " decoding ${type} done."
144
- done
145
- fi
146
115
echo " Finished"
147
116
148
-
149
- if [ ${stage} -le 101 ] && [ ${stop_stage} -ge 101 ]; then
150
- # format the reference test file for sclite
151
- python utils/format_rsl.py \
152
- --origin_ref data/manifest.test.raw \
153
- --trans_ref_sclite data/manifest.test.raw.text.sclite
154
-
155
- for type in attention ctc_greedy_search ctc_prefix_beam_search attention_rescoring; do
156
- python utils/format_rsl.py \
157
- --origin_hyp ${ckpt_prefix} .${type} .rsl
158
- --trans_hyp_sclite ${ckpt_prefix} .${type} .rsl.text.sclite
159
-
160
- mkdir -p ${ckpt_prefix} .${type} _sclite
161
- sclite -i wsj -r data/manifest.test.raw.text.sclite -h ${ckpt_prefix} .${type} .rsl.text.sclite -e utf-8 -o all -O ${ckpt_prefix} .${type} _sclite
162
- done
163
- fi
164
-
165
117
exit 0
0 commit comments