Skip to content

Commit 959eb9b

Browse files
author
Yibing Liu
authored
Merge pull request #52 from kuke/add_en8k_script
Add infer & test scripts for baidu_en8k model
2 parents 78968af + c786b18 commit 959eb9b

File tree

2 files changed

+110
-0
lines changed

2 files changed

+110
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#! /usr/bin/env bash
2+
3+
cd ../.. > /dev/null
4+
5+
# download language model
6+
cd models/lm > /dev/null
7+
sh download_lm_en.sh
8+
if [ $? -ne 0 ]; then
9+
exit 1
10+
fi
11+
cd - > /dev/null
12+
13+
14+
# download well-trained model
15+
cd models/baidu_en8k > /dev/null
16+
sh download_model.sh
17+
if [ $? -ne 0 ]; then
18+
exit 1
19+
fi
20+
cd - > /dev/null
21+
22+
23+
# infer
24+
CUDA_VISIBLE_DEVICES=0 \
25+
python -u infer.py \
26+
--num_samples=10 \
27+
--trainer_count=1 \
28+
--beam_size=500 \
29+
--num_proc_bsearch=5 \
30+
--num_conv_layers=2 \
31+
--num_rnn_layers=3 \
32+
--rnn_layer_size=1024 \
33+
--alpha=1.4 \
34+
--beta=0.35 \
35+
--cutoff_prob=1.0 \
36+
--cutoff_top_n=40 \
37+
--use_gru=True \
38+
--use_gpu=True \
39+
--share_rnn_weights=False \
40+
--infer_manifest='data/librispeech/manifest.test-clean' \
41+
--mean_std_path='models/baidu_en8k/mean_std.npz' \
42+
--vocab_path='models/baidu_en8k/vocab.txt' \
43+
--model_path='models/baidu_en8k/params.tar.gz' \
44+
--lang_model_path='models/lm/common_crawl_00.prune01111.trie.klm' \
45+
--decoding_method='ctc_beam_search' \
46+
--error_rate_type='wer' \
47+
--specgram_type='linear'
48+
49+
if [ $? -ne 0 ]; then
50+
echo "Failed in inference!"
51+
exit 1
52+
fi
53+
54+
55+
exit 0
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#! /usr/bin/env bash
2+
3+
cd ../.. > /dev/null
4+
5+
# download language model
6+
cd models/lm > /dev/null
7+
sh download_lm_en.sh
8+
if [ $? -ne 0 ]; then
9+
exit 1
10+
fi
11+
cd - > /dev/null
12+
13+
14+
# download well-trained model
15+
cd models/baidu_en8k > /dev/null
16+
sh download_model.sh
17+
if [ $? -ne 0 ]; then
18+
exit 1
19+
fi
20+
cd - > /dev/null
21+
22+
23+
# evaluate model
24+
CUDA_VISIBLE_DEVICES=0,1,2,3 \
25+
python -u test.py \
26+
--batch_size=128 \
27+
--trainer_count=4 \
28+
--beam_size=500 \
29+
--num_proc_bsearch=8 \
30+
--num_proc_data=8 \
31+
--num_conv_layers=2 \
32+
--num_rnn_layers=3 \
33+
--rnn_layer_size=1024 \
34+
--alpha=1.4 \
35+
--beta=0.35 \
36+
--cutoff_prob=1.0 \
37+
--cutoff_top_n=40 \
38+
--use_gru=True \
39+
--use_gpu=True \
40+
--share_rnn_weights=False \
41+
--test_manifest='data/librispeech/manifest.test-clean' \
42+
--mean_std_path='models/baidu_en8k/mean_std.npz' \
43+
--vocab_path='models/baidu_en8k/vocab.txt' \
44+
--model_path='models/baidu_en8k/params.tar.gz' \
45+
--lang_model_path='models/lm/common_crawl_00.prune01111.trie.klm' \
46+
--decoding_method='ctc_beam_search' \
47+
--error_rate_type='wer' \
48+
--specgram_type='linear'
49+
50+
if [ $? -ne 0 ]; then
51+
echo "Failed in evaluation!"
52+
exit 1
53+
fi
54+
55+
exit 0

0 commit comments

Comments
 (0)