Skip to content

Commit

Permalink
Merge pull request kaldi-asr#14 from aarora8/madcat_ar_lm
Browse files Browse the repository at this point in the history
updating parameters
  • Loading branch information
aarora8 authored May 12, 2018
2 parents f0346a1 + 80c659e commit cda2394
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 51 deletions.
21 changes: 10 additions & 11 deletions egs/madcat_ar/v1/local/chain/run_cnn_1a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,22 @@ if [ $stage -le 4 ]; then

num_targets=$(tree-info $tree_dir/tree | grep num-pdfs | awk '{print $2}')
learning_rate_factor=$(echo "print 0.5/$xent_regularize" | python)
opts="l2-regularize=0.001"
common1="$opts height-offsets=-2,-1,0,1,2 num-filters-out=36"
common2="$opts height-offsets=-2,-1,0,1,2 num-filters-out=70"
common1="height-offsets=-2,-1,0,1,2 num-filters-out=36"
common2="height-offsets=-2,-1,0,1,2 num-filters-out=70"
mkdir -p $dir/configs
cat <<EOF > $dir/configs/network.xconfig
input dim=40 name=input
conv-relu-batchnorm-layer name=cnn1 height-in=40 height-out=40 time-offsets=-3,-2,-1,0,1,2,3 $common1
conv-relu-batchnorm-layer name=cnn2 height-in=40 height-out=20 time-offsets=-2,-1,0,1,2 $common1 height-subsample-out=2
conv-relu-batchnorm-layer name=cnn3 height-in=20 height-out=20 time-offsets=-4,-2,0,2,4 $common2
conv-relu-batchnorm-layer name=cnn4 height-in=20 height-out=10 time-offsets=-4,-2,0,2,4 $common2 height-subsample-out=2
relu-batchnorm-layer name=tdnn1 input=Append(-4,0,4) dim=$tdnn_dim $opts
relu-batchnorm-layer name=tdnn2 input=Append(-4,0,4) dim=$tdnn_dim $opts
relu-batchnorm-layer name=tdnn3 input=Append(-4,0,4) dim=$tdnn_dim $opts
relu-batchnorm-layer name=tdnn4 input=Append(-4,0,4) dim=$tdnn_dim $opts
relu-batchnorm-layer name=tdnn1 input=Append(-4,0,4) dim=$tdnn_dim
relu-batchnorm-layer name=tdnn2 input=Append(-4,0,4) dim=$tdnn_dim
relu-batchnorm-layer name=tdnn3 input=Append(-4,0,4) dim=$tdnn_dim
relu-batchnorm-layer name=tdnn4 input=Append(-4,0,4) dim=$tdnn_dim
## adding the layers for chain branch
relu-batchnorm-layer name=prefinal-chain dim=$tdnn_dim target-rms=0.5 $opts
output-layer name=output include-log-softmax=false dim=$num_targets max-change=1.5 $opts
relu-batchnorm-layer name=prefinal-chain dim=$tdnn_dim target-rms=0.5
output-layer name=output include-log-softmax=false dim=$num_targets max-change=1.5
# adding the layers for xent branch
# This block prints the configs for a separate output that will be
# trained with a cross-entropy objective in the 'chain' mod?els... this
Expand All @@ -149,8 +148,8 @@ if [ $stage -le 4 ]; then
# final-layer learns at a rate independent of the regularization
# constant; and the 0.5 was tuned so as to make the relative progress
# similar in the xent and regular final layers.
relu-batchnorm-layer name=prefinal-xent input=tdnn4 dim=$tdnn_dim target-rms=0.5 $opts
output-layer name=output-xent dim=$num_targets learning-rate-factor=$learning_rate_factor max-change=1.5 $opts
relu-batchnorm-layer name=prefinal-xent input=tdnn4 dim=$tdnn_dim target-rms=0.5
output-layer name=output-xent dim=$num_targets learning-rate-factor=$learning_rate_factor max-change=1.5
EOF
steps/nnet3/xconfig_to_configs.py --xconfig-file $dir/configs/network.xconfig --config-dir $dir/configs/
fi
Expand Down
22 changes: 10 additions & 12 deletions egs/madcat_ar/v1/local/chain/run_cnn_chainali_1b.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,9 @@ if [ $stage -le 4 ]; then

num_targets=$(tree-info $tree_dir/tree | grep num-pdfs | awk '{print $2}')
learning_rate_factor=$(echo "print 0.5/$xent_regularize" | python)
opts="l2-regularize=0.01"
opts_2="l2-regularize=0.01"
common1="$opts required-time-offsets= height-offsets=-2,-1,0,1,2 num-filters-out=36"
common2="$opts required-time-offsets= height-offsets=-2,-1,0,1,2 num-filters-out=70"
common3="$opts required-time-offsets= height-offsets=-1,0,1 num-filters-out=70"
common1="required-time-offsets= height-offsets=-2,-1,0,1,2 num-filters-out=36"
common2="required-time-offsets= height-offsets=-2,-1,0,1,2 num-filters-out=70"
common3="required-time-offsets= height-offsets=-1,0,1 num-filters-out=70"
mkdir -p $dir/configs
cat <<EOF > $dir/configs/network.xconfig
input dim=40 name=input
Expand All @@ -137,12 +135,12 @@ if [ $stage -le 4 ]; then
conv-relu-batchnorm-layer name=cnn5 height-in=20 height-out=10 time-offsets=-4,-2,0,2,4 $common2 height-subsample-out=2
conv-relu-batchnorm-layer name=cnn6 height-in=10 height-out=10 time-offsets=-4,0,4 $common3
conv-relu-batchnorm-layer name=cnn7 height-in=10 height-out=10 time-offsets=-4,0,4 $common3
relu-batchnorm-layer name=tdnn1 input=Append(-4,0,4) dim=$tdnn_dim $opts
relu-batchnorm-layer name=tdnn2 input=Append(-4,0,4) dim=$tdnn_dim $opts
relu-batchnorm-layer name=tdnn3 input=Append(-4,0,4) dim=$tdnn_dim $opts
relu-batchnorm-layer name=tdnn1 input=Append(-4,0,4) dim=$tdnn_dim
relu-batchnorm-layer name=tdnn2 input=Append(-4,0,4) dim=$tdnn_dim
relu-batchnorm-layer name=tdnn3 input=Append(-4,0,4) dim=$tdnn_dim
## adding the layers for chain branch
relu-batchnorm-layer name=prefinal-chain dim=$tdnn_dim target-rms=0.5 $opts
output-layer name=output include-log-softmax=false dim=$num_targets max-change=1.5 $opts
relu-batchnorm-layer name=prefinal-chain dim=$tdnn_dim target-rms=0.5
output-layer name=output include-log-softmax=false dim=$num_targets max-change=1.5
# adding the layers for xent branch
# This block prints the configs for a separate output that will be
# trained with a cross-entropy objective in the 'chain' mod?els... this
Expand All @@ -152,8 +150,8 @@ if [ $stage -le 4 ]; then
# final-layer learns at a rate independent of the regularization
# constant; and the 0.5 was tuned so as to make the relative progress
# similar in the xent and regular final layers.
relu-batchnorm-layer name=prefinal-xent input=tdnn3 dim=$tdnn_dim target-rms=0.5 $opts
output-layer name=output-xent dim=$num_targets learning-rate-factor=$learning_rate_factor max-change=1.5 $opts
relu-batchnorm-layer name=prefinal-xent input=tdnn3 dim=$tdnn_dim target-rms=0.5
output-layer name=output-xent dim=$num_targets learning-rate-factor=$learning_rate_factor max-change=1.5
EOF
steps/nnet3/xconfig_to_configs.py --xconfig-file $dir/configs/network.xconfig --config-dir $dir/configs/
fi
Expand Down
23 changes: 10 additions & 13 deletions egs/madcat_ar/v1/local/chain/run_cnn_e2eali_1a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,9 @@ if [ $stage -le 4 ]; then

num_targets=$(tree-info $tree_dir/tree | grep num-pdfs | awk '{print $2}')
learning_rate_factor=$(echo "print 0.5/$xent_regularize" | python)
cnn_opts="l2-regularize=0.005"
tdnn_opts="l2-regularize=0.005"
output_opts="l2-regularize=0.005"
common1="$cnn_opts required-time-offsets= height-offsets=-2,-1,0,1,2 num-filters-out=36"
common2="$cnn_opts required-time-offsets= height-offsets=-2,-1,0,1,2 num-filters-out=70"
common3="$cnn_opts required-time-offsets= height-offsets=-1,0,1 num-filters-out=70"
common1="required-time-offsets= height-offsets=-2,-1,0,1,2 num-filters-out=36"
common2="required-time-offsets= height-offsets=-2,-1,0,1,2 num-filters-out=70"
common3="required-time-offsets= height-offsets=-1,0,1 num-filters-out=70"
mkdir -p $dir/configs
cat <<EOF > $dir/configs/network.xconfig
input dim=40 name=input
Expand All @@ -137,13 +134,13 @@ if [ $stage -le 4 ]; then
conv-relu-batchnorm-layer name=cnn5 height-in=20 height-out=10 time-offsets=-4,-2,0,2,4 $common2 height-subsample-out=2
conv-relu-batchnorm-layer name=cnn6 height-in=10 height-out=10 time-offsets=-4,0,4 $common3
conv-relu-batchnorm-layer name=cnn7 height-in=10 height-out=10 time-offsets=-4,0,4 $common3
relu-batchnorm-layer name=tdnn1 input=Append(-4,0,4) dim=$tdnn_dim $tdnn_opts
relu-batchnorm-layer name=tdnn2 input=Append(-4,0,4) dim=$tdnn_dim $tdnn_opts
relu-batchnorm-layer name=tdnn3 input=Append(-4,0,4) dim=$tdnn_dim $tdnn_opts
relu-batchnorm-layer name=tdnn1 input=Append(-4,0,4) dim=$tdnn_dim
relu-batchnorm-layer name=tdnn2 input=Append(-4,0,4) dim=$tdnn_dim
relu-batchnorm-layer name=tdnn3 input=Append(-4,0,4) dim=$tdnn_dim
## adding the layers for chain branch
relu-batchnorm-layer name=prefinal-chain dim=$tdnn_dim target-rms=0.5 $tdnn_opts
output-layer name=output include-log-softmax=false dim=$num_targets max-change=1.5 $output_opts
relu-batchnorm-layer name=prefinal-chain dim=$tdnn_dim target-rms=0.5
output-layer name=output include-log-softmax=false dim=$num_targets max-change=1.5
# adding the layers for xent branch
# This block prints the configs for a separate output that will be
Expand All @@ -154,8 +151,8 @@ if [ $stage -le 4 ]; then
# final-layer learns at a rate independent of the regularization
# constant; and the 0.5 was tuned so as to make the relative progress
# similar in the xent and regular final layers.
relu-batchnorm-layer name=prefinal-xent input=tdnn3 dim=$tdnn_dim target-rms=0.5 $tdnn_opts
output-layer name=output-xent dim=$num_targets learning-rate-factor=$learning_rate_factor max-change=1.5 $output_opts
relu-batchnorm-layer name=prefinal-xent input=tdnn3 dim=$tdnn_dim target-rms=0.5
output-layer name=output-xent dim=$num_targets learning-rate-factor=$learning_rate_factor max-change=1.5
EOF
steps/nnet3/xconfig_to_configs.py --xconfig-file $dir/configs/network.xconfig --config-dir $dir/configs/
fi
Expand Down
23 changes: 10 additions & 13 deletions egs/madcat_ar/v1/local/chain/run_cnn_e2eali_1b.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,9 @@ if [ $stage -le 4 ]; then

num_targets=$(tree-info $tree_dir/tree | grep num-pdfs | awk '{print $2}')
learning_rate_factor=$(echo "print 0.5/$xent_regularize" | python)
cnn_opts="l2-regularize=0.005"
tdnn_opts="l2-regularize=0.005"
output_opts="l2-regularize=0.005"
common1="$cnn_opts required-time-offsets= height-offsets=-2,-1,0,1,2 num-filters-out=36"
common2="$cnn_opts required-time-offsets= height-offsets=-2,-1,0,1,2 num-filters-out=70"
common3="$cnn_opts required-time-offsets= height-offsets=-1,0,1 num-filters-out=70"
common1="required-time-offsets= height-offsets=-2,-1,0,1,2 num-filters-out=36"
common2="required-time-offsets= height-offsets=-2,-1,0,1,2 num-filters-out=70"
common3="required-time-offsets= height-offsets=-1,0,1 num-filters-out=70"
mkdir -p $dir/configs
cat <<EOF > $dir/configs/network.xconfig
input dim=40 name=input
Expand All @@ -137,13 +134,13 @@ if [ $stage -le 4 ]; then
conv-relu-batchnorm-layer name=cnn5 height-in=20 height-out=10 time-offsets=-4,-2,0,2,4 $common2 height-subsample-out=2
conv-relu-batchnorm-layer name=cnn6 height-in=10 height-out=10 time-offsets=-4,0,4 $common3
conv-relu-batchnorm-layer name=cnn7 height-in=10 height-out=10 time-offsets=-4,0,4 $common3
relu-batchnorm-layer name=tdnn1 input=Append(-4,0,4) dim=$tdnn_dim $tdnn_opts
relu-batchnorm-layer name=tdnn2 input=Append(-4,0,4) dim=$tdnn_dim $tdnn_opts
relu-batchnorm-layer name=tdnn3 input=Append(-4,0,4) dim=$tdnn_dim $tdnn_opts
relu-batchnorm-layer name=tdnn1 input=Append(-4,0,4) dim=$tdnn_dim
relu-batchnorm-layer name=tdnn2 input=Append(-4,0,4) dim=$tdnn_dim
relu-batchnorm-layer name=tdnn3 input=Append(-4,0,4) dim=$tdnn_dim
## adding the layers for chain branch
relu-batchnorm-layer name=prefinal-chain dim=$tdnn_dim target-rms=0.5 $tdnn_opts
output-layer name=output include-log-softmax=false dim=$num_targets max-change=1.5 $output_opts
relu-batchnorm-layer name=prefinal-chain dim=$tdnn_dim target-rms=0.5
output-layer name=output include-log-softmax=false dim=$num_targets max-change=1.5
# adding the layers for xent branch
# This block prints the configs for a separate output that will be
Expand All @@ -154,8 +151,8 @@ if [ $stage -le 4 ]; then
# final-layer learns at a rate independent of the regularization
# constant; and the 0.5 was tuned so as to make the relative progress
# similar in the xent and regular final layers.
relu-batchnorm-layer name=prefinal-xent input=tdnn3 dim=$tdnn_dim target-rms=0.5 $tdnn_opts
output-layer name=output-xent dim=$num_targets learning-rate-factor=$learning_rate_factor max-change=1.5 $output_opts
relu-batchnorm-layer name=prefinal-xent input=tdnn3 dim=$tdnn_dim target-rms=0.5
output-layer name=output-xent dim=$num_targets learning-rate-factor=$learning_rate_factor max-change=1.5
EOF
steps/nnet3/xconfig_to_configs.py --xconfig-file $dir/configs/network.xconfig --config-dir $dir/configs/
fi
Expand Down
4 changes: 2 additions & 2 deletions egs/wsj/s5/steps/nnet3/chain/get_egs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ utils/data/get_utt2dur.sh $data

cat $data/utt2dur | \
awk -v min_len=$frames_per_eg -v fs=$frame_shift '{if ($2 * 1/fs >= min_len) print $1}' | \
utils/shuffle_list.pl | head -$num_utts_subset > $dir/valid_uttlist || exit 1;
utils/shuffle_list.pl 2>/dev/null | head -$num_utts_subset > $dir/valid_uttlist

len_uttlist=`wc -l $dir/valid_uttlist | awk '{print $1}'`
if [ $len_uttlist -lt $num_utts_subset ]; then
Expand All @@ -180,7 +180,7 @@ echo "$0: creating egs. To ensure they are not deleted later you can do: touch
cat $data/utt2dur | \
awk -v min_len=$frames_per_eg -v fs=$frame_shift '{if ($2 * 1/fs >= min_len) print $1}' | \
utils/filter_scp.pl --exclude $dir/valid_uttlist | \
utils/shuffle_list.pl | head -$num_utts_subset > $dir/train_subset_uttlist || exit 1;
utils/shuffle_list.pl 2>/dev/null | head -$num_utts_subset > $dir/train_subset_uttlist
len_uttlist=`wc -l $dir/train_subset_uttlist | awk '{print $1}'`
if [ $len_uttlist -lt $num_utts_subset ]; then
echo "Number of utterances which have length at least $frames_per_eg is really low. Please check your data." && exit 1;
Expand Down

0 comments on commit cda2394

Please sign in to comment.