Blame view
egs/zeroth_korean/s5/run.sh
9.8 KB
8dcb6dfcb first commit |
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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
#!/bin/bash # # Based mostly on the WSJ/Librispeech recipe. # The training/testing database is described in http://www.openslr.org/40/ # This corpus consists of 51hrs korean speech with cleaned automatic transcripts: # # Copyright 2018 Atlas Guide (Author : Lucas Jo) # 2018 Gridspace Inc. (Author: Wonkyum Lee) # # Apache 2.0 # # Check list before start # 1. required software: Morfessor-2.0.1 (see tools/extras/install_morfessor.sh) stage=0 db_dir=./db nj=16 chain_train=true decode=true # set false if you don't want to decode each GMM model decode_rescoring=true # set false if you don't want to rescore with large language model test_set="test_clean" . ./cmd.sh . ./path.sh . utils/parse_options.sh # e.g. this parses the --stage option if supplied. # you might not want to do this for interactive shells. set -e if [ $stage -le 0 ]; then # download the data. local/download_and_untar.sh $db_dir fi if [ $stage -le 1 ]; then # format the data as Kaldi data directories for part in train_data_01 test_data_01; do # use underscore-separated names in data directories. local/data_prep.sh $db_dir $part done fi if [ $stage -le 2 ]; then # update segmentation of transcripts for part in train_data_01 test_data_01; do local/update_segmentation.sh data/$part data/local/lm done fi if [ $stage -le 3 ]; then # prepare dictionary and language model local/prepare_dict.sh data/local/lm data/local/dict_nosp utils/prepare_lang.sh data/local/dict_nosp \ "<UNK>" data/local/lang_tmp_nosp data/lang_nosp fi if [ $stage -le 4 ]; then # build testing language model local/format_lms.sh --src-dir data/lang_nosp data/local/lm # re-scoring language model if $decode_rescoring ; then utils/build_const_arpa_lm.sh data/local/lm/zeroth.lm.tg.arpa.gz \ data/lang_nosp data/lang_nosp_test_tglarge utils/build_const_arpa_lm.sh data/local/lm/zeroth.lm.fg.arpa.gz \ data/lang_nosp data/lang_nosp_test_fglarge fi fi if [ $stage -le 5 ]; then # Feature extraction (MFCC) mfccdir=mfcc for part in train_data_01 test_data_01; do steps/make_mfcc.sh --cmd "$train_cmd" --nj $nj data/$part exp/make_mfcc/$part $mfccdir steps/compute_cmvn_stats.sh data/$part exp/make_mfcc/$part $mfccdir done # ... and then combine data sets into one (for later extension) utils/combine_data.sh \ data/train_clean data/train_data_01 utils/combine_data.sh \ data/test_clean data/test_data_01 # Make some small data subsets for early system-build stages. utils/subset_data_dir.sh --shortest data/train_clean 2000 data/train_2kshort utils/subset_data_dir.sh data/train_clean 5000 data/train_5k utils/subset_data_dir.sh data/train_clean 10000 data/train_10k fi if [ $stage -le 6 ]; then echo "$0: #### Monophone Training ###########" # train a monophone system with 2k short utts steps/train_mono.sh --boost-silence 1.25 --nj $nj --cmd "$train_cmd" \ data/train_2kshort data/lang_nosp exp/mono if $decode; then utils/mkgraph.sh data/lang_nosp_test_tgsmall exp/mono exp/mono/graph_nosp_tgsmall nspk=$(wc -l <data/${test_set}/spk2utt) steps/decode.sh --nj $nspk --cmd "$decode_cmd" \ exp/mono/graph_nosp_tgsmall data/${test_set} exp/mono/decode_nosp_tgsmall_${test_set} if $decode_rescoring; then steps/lmrescore_const_arpa.sh \ --cmd "$decode_cmd" data/lang_nosp_test_{tgsmall,tglarge} \ data/$test_set exp/mono/decode_nosp_{tgsmall,tglarge}_$test_set steps/lmrescore_const_arpa.sh \ --cmd "$decode_cmd" data/lang_nosp_test_{tgsmall,fglarge} \ data/$test_set exp/mono/decode_nosp_{tgsmall,fglarge}_$test_set fi fi fi if [ $stage -le 7 ]; then echo "$0: #### Triphone Training, delta + delta-delta ###########" steps/align_si.sh --boost-silence 1.25 --nj $nj --cmd "$train_cmd" \ data/train_5k data/lang_nosp exp/mono exp/mono_ali_5k # train a first delta + delta-delta triphone system on a subset of 5000 utterances steps/train_deltas.sh --boost-silence 1.25 --cmd "$train_cmd" \ 2000 10000 data/train_5k data/lang_nosp exp/mono_ali_5k exp/tri1 if $decode; then utils/mkgraph.sh data/lang_nosp_test_tgsmall exp/tri1 exp/tri1/graph_nosp_tgsmall nspk=$(wc -l <data/${test_set}/spk2utt) steps/decode.sh --nj $nspk --cmd "$decode_cmd" \ exp/tri1/graph_nosp_tgsmall data/${test_set} exp/tri1/decode_nosp_tgsmall_${test_set} if $decode_rescoring; then steps/lmrescore_const_arpa.sh \ --cmd "$decode_cmd" data/lang_nosp_test_{tgsmall,tglarge} \ data/$test_set exp/tri1/decode_nosp_{tgsmall,tglarge}_$test_set steps/lmrescore_const_arpa.sh \ --cmd "$decode_cmd" data/lang_nosp_test_{tgsmall,fglarge} \ data/$test_set exp/tri1/decode_nosp_{tgsmall,fglarge}_$test_set fi fi fi if [ $stage -le 8 ]; then echo "$0: #### Triphone Training, LDA+MLLT ###########" steps/align_si.sh --nj $nj --cmd "$train_cmd" \ data/train_10k data/lang_nosp exp/tri1 exp/tri1_ali_10k # train an LDA+MLLT system. steps/train_lda_mllt.sh --cmd "$train_cmd" \ --splice-opts "--left-context=3 --right-context=3" 2500 15000 \ data/train_10k data/lang_nosp exp/tri1_ali_10k exp/tri2 if $decode; then utils/mkgraph.sh data/lang_nosp_test_tgsmall exp/tri2 exp/tri2/graph_nosp_tgsmall nspk=$(wc -l <data/${test_set}/spk2utt) steps/decode.sh --nj $nspk --cmd "$decode_cmd" \ exp/tri2/graph_nosp_tgsmall data/${test_set} exp/tri2/decode_nosp_tgsmall_${test_set} if $decode_rescoring; then steps/lmrescore_const_arpa.sh \ --cmd "$decode_cmd" data/lang_nosp_test_{tgsmall,tglarge} \ data/$test_set exp/tri2/decode_nosp_{tgsmall,tglarge}_$test_set steps/lmrescore_const_arpa.sh \ --cmd "$decode_cmd" data/lang_nosp_test_{tgsmall,fglarge} \ data/$test_set exp/tri2/decode_nosp_{tgsmall,fglarge}_$test_set fi fi fi if [ $stage -le 9 ]; then echo "$0: #### Triphone Training, LDA+MLLT+SAT ###########" # Align the entire train_clean using the tri2 model steps/align_si.sh --nj $nj --cmd "$train_cmd" --use-graphs true \ data/train_clean data/lang_nosp exp/tri2 exp/tri2_ali_train_clean # Train tri3, which is LDA+MLLT+SAT on the entire train_clean steps/train_sat.sh --cmd "$train_cmd" 4200 40000 \ data/train_clean data/lang_nosp exp/tri2_ali_train_clean exp/tri3 if $decode; then utils/mkgraph.sh data/lang_nosp_test_tgsmall exp/tri3 exp/tri3/graph_nosp_tgsmall nspk=$(wc -l <data/${test_set}/spk2utt) steps/decode_fmllr.sh --nj $nspk --cmd "$decode_cmd" \ exp/tri3/graph_nosp_tgsmall data/${test_set} exp/tri3/decode_nosp_tgsmall_${test_set} if $decode_rescoring; then steps/lmrescore_const_arpa.sh \ --cmd "$decode_cmd" data/lang_nosp_test_{tgsmall,tglarge} \ data/$test_set exp/tri3/decode_nosp_{tgsmall,tglarge}_$test_set steps/lmrescore_const_arpa.sh \ --cmd "$decode_cmd" data/lang_nosp_test_{tgsmall,fglarge} \ data/$test_set exp/tri3/decode_nosp_{tgsmall,fglarge}_$test_set fi fi fi if [ $stage -le 10 ]; then echo "$0: #### Re-computing pronunciation model using tri3 model ###########" # Now we compute the pronunciation and silence probabilities from training data, # and re-create the lang directory. # silence transition probability ... steps/get_prons.sh --cmd "$train_cmd" \ data/train_clean data/lang_nosp exp/tri3 utils/dict_dir_add_pronprobs.sh --max-normalize true \ data/local/dict_nosp \ exp/tri3/pron_counts_nowb.txt exp/tri3/sil_counts_nowb.txt \ exp/tri3/pron_bigram_counts_nowb.txt data/local/dict utils/prepare_lang.sh data/local/dict \ "<UNK>" data/local/lang_tmp data/lang local/format_lms.sh --src-dir data/lang data/local/lm utils/build_const_arpa_lm.sh \ data/local/lm/zeroth.lm.tg.arpa.gz data/lang data/lang_test_tglarge utils/build_const_arpa_lm.sh \ data/local/lm/zeroth.lm.fg.arpa.gz data/lang data/lang_test_fglarge if $decode; then utils/mkgraph.sh data/lang_test_tgsmall exp/tri3 exp/tri3/graph_tgsmall nspk=$(wc -l <data/${test_set}/spk2utt) steps/decode_fmllr.sh --nj $nspk --cmd "$decode_cmd" \ exp/tri3/graph_tgsmall data/${test_set} exp/tri3/decode_tgsmall_${test_set} if $decode_rescoring; then steps/lmrescore_const_arpa.sh \ --cmd "$decode_cmd" data/lang_test_{tgsmall,tglarge} \ data/$test_set exp/tri3/decode_{tgsmall,tglarge}_$test_set steps/lmrescore_const_arpa.sh \ --cmd "$decode_cmd" data/lang_test_{tgsmall,fglarge} \ data/$test_set exp/tri3/decode_{tgsmall,fglarge}_$test_set fi fi fi if [ $stage -le 11 ]; then echo "$0: #### SAT again on train_clean ###########" # align the entire train_clean using the tri3 model steps/align_fmllr.sh --nj $nj --cmd "$train_cmd" \ data/train_clean data/lang exp/tri3 exp/tri3_ali_train_clean # train another LDA+MLLT+SAT system on the entire train_clean steps/train_sat.sh --cmd "$train_cmd" 4200 40000 \ data/train_clean data/lang exp/tri3_ali_train_clean exp/tri4 if $decode; then utils/mkgraph.sh data/lang_test_tgsmall exp/tri4 exp/tri4/graph_tgsmall nspk=$(wc -l <data/${test_set}/spk2utt) steps/decode_fmllr.sh --nj $nspk --cmd "$decode_cmd" \ exp/tri4/graph_tgsmall data/${test_set} exp/tri4/decode_tgsmall_${test_set} if $decode_rescoring; then steps/lmrescore_const_arpa.sh \ --cmd "$decode_cmd" data/lang_test_{tgsmall,tglarge} \ data/$test_set exp/tri4/decode_{tgsmall,tglarge}_$test_set steps/lmrescore_const_arpa.sh \ --cmd "$decode_cmd" data/lang_test_{tgsmall,fglarge} \ data/$test_set exp/tri4/decode_{tgsmall,fglarge}_$test_set fi fi fi echo "$0: GMM trainig is Done" if $chain_train; then ## Training Chain Acoustic model using clean data set echo "$0: #### chain training ###########" local/chain/run_tdnn.sh fi exit 0; |