Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace LDA layer with delta and delta-delta features #3490

Merged
merged 8 commits into from
Aug 2, 2019
Next Next commit
added delta features script
  • Loading branch information
desh2608 committed Jul 21, 2019
commit bb23ee927ca7cfea3e90cdc1b7e55a3446128356
16 changes: 13 additions & 3 deletions egs/swbd/s5c/local/chain/tuning/run_tdnn_7q.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ stage=0
train_stage=-10
get_egs_stage=-10
speed_perturb=true
affix=7q
affix=7r
if [ -e data/rt03 ]; then maybe_rt03=rt03; else maybe_rt03= ; fi

decode_iter=
Expand Down Expand Up @@ -131,13 +131,23 @@ if [ $stage -le 12 ]; then
input dim=100 name=ivector
input dim=40 name=input

no-op-component name=delta_1 input=Scale(-1.0, Offset(input, -1))
no-op-component name=delta_2 input=Scale(1.0, Offset(input, 1))
no-op-component name=delta_delta_1 input=Scale(-2.0, input)
no-op-component name=delta_delta_2 input=Scale(1.0, Offset(input,-2))
no-op-component name=delta_delta_3 input=Scale(1.0, Offset(input,2))

# please note that it is important to have input layer with the name=input
# as the layer immediately preceding the fixed-affine-layer to enable
# the use of short notation for the descriptor
fixed-affine-layer name=lda input=Append(-1,0,1,ReplaceIndex(ivector, t, 0)) affine-transform-file=$dir/configs/lda.mat
#fixed-affine-layer name=lda input=Append(-1,0,1,ReplaceIndex(ivector, t, 0)) affine-transform-file=$dir/configs/lda.mat
no-op-component name=input2 input=Append(Offset(input,0), Sum(delta_1, delta_2), Sum(delta_delta_1, delta_delta_2, delta_delta_3))

batchnorm-component name=bn_input
no-op-component name=input3 input=Append(bn_input, Scale(1.0, ReplaceIndex(ivector, t, 0)))

# the first splicing is moved before the lda layer, so no splicing here
relu-batchnorm-dropout-layer name=tdnn1 $affine_opts dim=1536
relu-batchnorm-dropout-layer name=tdnn1 $affine_opts dim=1536 input=input3
tdnnf-layer name=tdnnf2 $tdnnf_opts dim=1536 bottleneck-dim=160 time-stride=1
tdnnf-layer name=tdnnf3 $tdnnf_opts dim=1536 bottleneck-dim=160 time-stride=1
tdnnf-layer name=tdnnf4 $tdnnf_opts dim=1536 bottleneck-dim=160 time-stride=1
Expand Down
16 changes: 13 additions & 3 deletions egs/wsj/s5/local/chain/tuning/run_tdnn_1g.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ chunk_right_context=0

# training options
srand=0
remove_egs=true
remove_egs=false

#decode options
test_online_decoding=false # if true, it will run the last decoding stage.
Expand Down Expand Up @@ -182,13 +182,23 @@ if [ $stage -le 15 ]; then
input dim=100 name=ivector
input dim=40 name=input

no-op-component name=delta_1 input=Scale(-1.0, Offset(input, -1))
no-op-component name=delta_2 input=Scale(1.0, Offset(input, 1))
no-op-component name=delta_delta_1 input=Scale(-2.0, input)
no-op-component name=delta_delta_2 input=Scale(1.0, Offset(input,-2))
no-op-component name=delta_delta_3 input=Scale(1.0, Offset(input,2))

# please note that it is important to have input layer with the name=input
# as the layer immediately preceding the fixed-affine-layer to enable
# the use of short notation for the descriptor
fixed-affine-layer name=lda input=Append(-1,0,1,ReplaceIndex(ivector, t, 0)) affine-transform-file=$dir/configs/lda.mat
#fixed-affine-layer name=lda input=Append(-1,0,1,ReplaceIndex(ivector, t, 0)) affine-transform-file=$dir/configs/lda.mat
no-op-component name=input2 input=Append(Offset(input,0), Sum(delta_1, delta_2))

batchnorm-component name=bn_input
no-op-component name=input3 input=Append(bn_input, Scale(1.0, ReplaceIndex(ivector, t, 0)))

# the first splicing is moved before the lda layer, so no splicing here
relu-batchnorm-dropout-layer name=tdnn1 $tdnn_opts dim=1024
relu-batchnorm-dropout-layer name=tdnn1 $tdnn_opts dim=1024 input=input3
tdnnf-layer name=tdnnf2 $tdnnf_opts dim=1024 bottleneck-dim=128 time-stride=1
tdnnf-layer name=tdnnf3 $tdnnf_opts dim=1024 bottleneck-dim=128 time-stride=1
tdnnf-layer name=tdnnf4 $tdnnf_opts dim=1024 bottleneck-dim=128 time-stride=1
Expand Down