Skip to content

Commit 63a64e7

Browse files
committed
Smart split
1 parent 2668098 commit 63a64e7

File tree

90 files changed

+8119
-498
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+8119
-498
lines changed

egs/babel/s5d/local/chain/run_ivector_common.sh

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ gmm=tri5_cleaned # This specifies a GMM-dir from the features
1616
# of the type you're training the system on;
1717
# it should contain alignments for 'train_set'.
1818
langdir=data/langp/tri5_ali
19-
19+
generate_alignments=true # Set to false to skip alignment generation
2020
num_threads_ubm=12
2121
nnet3_affix=_cleaned
22+
extractor= # If supplied, uses this extractor instead of training a new one
2223

2324
. ./cmd.sh
2425
. ./path.sh
@@ -57,7 +58,7 @@ if [ $stage -le 1 ]; then
5758
utils/fix_data_dir.sh data/${train_set}_sp
5859
fi
5960

60-
if [ $stage -le 2 ]; then
61+
if $generate_alignments && [ $stage -le 2 ]; then
6162
echo "$0: aligning with the perturbed low-resolution data"
6263
steps/align_fmllr.sh --nj $nj --cmd "$train_cmd" \
6364
data/${train_set}_sp data/lang $gmm_dir $ali_dir || exit 1
@@ -93,53 +94,55 @@ if [ $stage -le 3 ]; then
9394
steps/compute_cmvn_stats.sh \
9495
data/${datadir}_hires_nopitch exp/make_hires/${datadir}_nopitch $mfccdir || exit 1;
9596
utils/fix_data_dir.sh data/${datadir}_hires_nopitch
96-
9797
done
9898
fi
9999

100-
if [ $stage -le 4 ]; then
101-
echo "$0: computing a subset of data to train the diagonal UBM."
102-
103-
mkdir -p exp/nnet3${nnet3_affix}/diag_ubm
104-
temp_data_root=exp/nnet3${nnet3_affix}/diag_ubm
105-
106-
# train a diagonal UBM using a subset of about a quarter of the data
107-
# we don't use the _comb data for this as there is no need for compatibility with
108-
# the alignments, and using the non-combined data is more efficient for I/O
109-
# (no messing about with piped commands).
110-
num_utts_total=$(wc -l <data/${train_set}_sp_hires/utt2spk)
111-
if [ $num_utts_total -le 14000 ] ; then
112-
num_utts=14000
113-
else
114-
num_utts=$num_utts_total
100+
if [ -z "$extractor" ]; then
101+
if [ $stage -le 4 ]; then
102+
echo "$0: computing a subset of data to train the diagonal UBM."
103+
104+
mkdir -p exp/nnet3${nnet3_affix}/diag_ubm
105+
temp_data_root=exp/nnet3${nnet3_affix}/diag_ubm
106+
107+
# train a diagonal UBM using a subset of about a quarter of the data
108+
# we don't use the _comb data for this as there is no need for compatibility with
109+
# the alignments, and using the non-combined data is more efficient for I/O
110+
# (no messing about with piped commands).
111+
num_utts_total=$(wc -l <data/${train_set}_sp_hires/utt2spk)
112+
if [ $num_utts_total -le 14000 ] ; then
113+
num_utts=14000
114+
else
115+
num_utts=$num_utts_total
116+
fi
117+
utils/data/subset_data_dir.sh data/${train_set}_sp_hires_nopitch \
118+
$num_utts ${temp_data_root}/${train_set}_sp_hires_nopitch_subset
119+
120+
echo "$0: computing a PCA transform from the hires data."
121+
steps/online/nnet2/get_pca_transform.sh --cmd "$train_cmd" \
122+
--splice-opts "--left-context=3 --right-context=3" \
123+
--max-utts 10000 --subsample 2 \
124+
${temp_data_root}/${train_set}_sp_hires_nopitch_subset \
125+
exp/nnet3${nnet3_affix}/pca_transform
126+
127+
echo "$0: training the diagonal UBM."
128+
# Use 512 Gaussians in the UBM.
129+
steps/online/nnet2/train_diag_ubm.sh --cmd "$train_cmd" --nj 30 \
130+
--num-frames 700000 \
131+
--num-threads $num_threads_ubm \
132+
${temp_data_root}/${train_set}_sp_hires_nopitch_subset 512 \
133+
exp/nnet3${nnet3_affix}/pca_transform exp/nnet3${nnet3_affix}/diag_ubm
115134
fi
116-
utils/data/subset_data_dir.sh data/${train_set}_sp_hires_nopitch \
117-
$num_utts ${temp_data_root}/${train_set}_sp_hires_nopitch_subset
118-
119-
echo "$0: computing a PCA transform from the hires data."
120-
steps/online/nnet2/get_pca_transform.sh --cmd "$train_cmd" \
121-
--splice-opts "--left-context=3 --right-context=3" \
122-
--max-utts 10000 --subsample 2 \
123-
${temp_data_root}/${train_set}_sp_hires_nopitch_subset \
124-
exp/nnet3${nnet3_affix}/pca_transform
125-
126-
echo "$0: training the diagonal UBM."
127-
# Use 512 Gaussians in the UBM.
128-
steps/online/nnet2/train_diag_ubm.sh --cmd "$train_cmd" --nj 30 \
129-
--num-frames 700000 \
130-
--num-threads $num_threads_ubm \
131-
${temp_data_root}/${train_set}_sp_hires_nopitch_subset 512 \
132-
exp/nnet3${nnet3_affix}/pca_transform exp/nnet3${nnet3_affix}/diag_ubm
133-
fi
134135

135-
if [ $stage -le 5 ]; then
136-
# Train the iVector extractor. Use all of the speed-perturbed data since iVector extractors
137-
# can be sensitive to the amount of data. The script defaults to an iVector dimension of
138-
# 100.
139-
echo "$0: training the iVector extractor"
140-
steps/online/nnet2/train_ivector_extractor.sh --cmd "$train_cmd" --nj 10 \
141-
data/${train_set}_sp_hires_nopitch exp/nnet3${nnet3_affix}/diag_ubm \
142-
exp/nnet3${nnet3_affix}/extractor || exit 1;
136+
if [ $stage -le 5 ]; then
137+
# Train the iVector extractor. Use all of the speed-perturbed data since iVector extractors
138+
# can be sensitive to the amount of data. The script defaults to an iVector dimension of
139+
# 100.
140+
echo "$0: training the iVector extractor"
141+
steps/online/nnet2/train_ivector_extractor.sh --cmd "$train_cmd" --nj 10 \
142+
data/${train_set}_sp_hires_nopitch exp/nnet3${nnet3_affix}/diag_ubm \
143+
exp/nnet3${nnet3_affix}/extractor || exit 1;
144+
fi
145+
extractor=exp/nnet3${nnet3_affix}/extractor
143146
fi
144147

145148
if [ $stage -le 6 ]; then
@@ -166,7 +169,7 @@ if [ $stage -le 6 ]; then
166169

167170
steps/online/nnet2/extract_ivectors_online.sh --cmd "$train_cmd" --nj $nj \
168171
${temp_data_root}/${train_set}_sp_hires_nopitch_max2 \
169-
exp/nnet3${nnet3_affix}/extractor $ivectordir
172+
$extractor $ivectordir
170173

171174
fi
172175

egs/babel/s5d/local/chain/tuning/run_tdnn_lstm_bab7.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,25 @@ set -e -o pipefail
2020

2121
# First the options that are passed through to run_ivector_common.sh
2222
# (some of which are also used in this script directly).
23-
stage=17
23+
stage=0
2424
nj=30
2525
dropout_schedule='0,[email protected],[email protected],0'
2626
train_set=train_cleaned
2727
gmm=tri5_cleaned # the gmm for the target data
2828
langdir=data/langp/tri5_ali
2929
num_threads_ubm=12
3030
nnet3_affix=_cleaned # cleanup affix for nnet3 and chain dirs, e.g. _cleaned
31+
num_epochs=4
32+
extractor= # Use a pre-trained i-vector extractor
3133

3234
# The rest are configs specific to this script. Most of the parameters
3335
# are just hardcoded at this level, in the commands below.
3436
train_stage=-10
3537
tree_affix= # affix for tree directory, e.g. "a" or "b", in case we change the configuration.
3638
tdnn_affix="_bab7" #affix for TDNN directory, e.g. "a" or "b", in case we change the configuration.
37-
common_egs_dir=exp/chain_cleaned/tdnn_lstm_sp/egs # you can set this to use previously dumped egs.
39+
common_egs_dir= # you can set this to use previously dumped egs.
3840
chunk_width=150,120,90,75
41+
chunk_left_context=40
3942

4043
# End configuration section.
4144
echo "$0 $@" # Print the command line for logging
@@ -58,7 +61,8 @@ local/chain/run_ivector_common.sh --stage $stage \
5861
--train-set $train_set \
5962
--gmm $gmm \
6063
--num-threads-ubm $num_threads_ubm \
61-
--nnet3-affix "$nnet3_affix"
64+
--nnet3-affix "$nnet3_affix" \
65+
--extractor "$extractor"
6266

6367

6468
gmm_dir=exp/$gmm
@@ -194,11 +198,15 @@ if [ $stage -le 18 ]; then
194198
--chain.apply-deriv-weights false \
195199
--chain.lm-opts="--num-extra-lm-states=2000" \
196200
--egs.dir "$common_egs_dir" \
201+
--egs.chunk-left-context $chunk_left_context \
202+
--egs.chunk-right-context 0 \
203+
--egs.chunk-left-context-initial 0 \
204+
--egs.chunk-right-context-final 0 \
197205
--egs.opts "--frames-overlap-per-eg 0" \
198206
--egs.chunk-width $chunk_width \
199-
--trainer.num-chunk-per-minibatch 128 \
207+
--trainer.num-chunk-per-minibatch 128,64 \
200208
--trainer.frames-per-iter 1500000 \
201-
--trainer.num-epochs 4 \
209+
--trainer.num-epochs $num_epochs \
202210
--trainer.optimization.num-jobs-initial 2 \
203211
--trainer.optimization.num-jobs-final 12 \
204212
--trainer.dropout-schedule $dropout_schedule \

0 commit comments

Comments
 (0)