Skip to content

Commit

Permalink
added output delay option in output-layer
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayaditya committed Nov 18, 2016
1 parent cef8782 commit 75bed1c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 3 additions & 5 deletions egs/swbd/s5c/local/chain/tuning/run_lstm_6j.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ if [ $stage -le 12 ]; then
lstmp-layer name=lstm3 cell-dim=1024 recurrent-projection-dim=256 non-recurrent-projection-dim=256 delay=-3
## adding the layers for chain branch
relu-renorm-layer name=chain-prefinal input=lstm3 target-rms=0.5
output-layer name=output input=$label_delay include-log-softmax=false dim=$num_targets max-change=1.5
output-layer name=output input=lstm3 output-delay=$label_delay 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 @@ -138,13 +137,12 @@ if [ $stage -le 12 ]; 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-renorm-layer name=xent-prefinal input=lstm3 target-rms=0.5
output-layer name=output-xent input=$label_delay dim=$num_targets learning-rate-factor=$learning_rate_factor max-change=1.5
output-layer name=output-xent input=lstm3 output-delay=$label_delay 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

exit 1;
if [ $stage -le 13 ]; then
if [[ $(hostname -f) == *.clsp.jhu.edu ]] && [ ! -d $dir/egs/storage ]; then
utils/create_split_dir.pl \
Expand Down
7 changes: 6 additions & 1 deletion egs/wsj/s5/steps/libs/nnet3/xconfig/basic_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,8 @@ def set_default_configs(self):
# frame-level objfns,
'max-change' : 1.5,
'param-stddev' : 0.0,
'bias-stddev' : 0.0
'bias-stddev' : 0.0,
'output-delay' : 0
}

def check_configs(self):
Expand Down Expand Up @@ -504,6 +505,7 @@ def get_full_config(self):
presoftmax_scale_file = self.config['presoftmax-scale-file']
param_stddev = self.config['param-stddev']
bias_stddev = self.config['bias-stddev']
output_delay = self.config['output-delay']

# note: ref.config is used only for getting the left-context and
# right-context of the network;
Expand Down Expand Up @@ -555,6 +557,9 @@ def get_full_config(self):
ans.append((config_name, line))
cur_node = '{0}.log-softmax'.format(self.name)

if output_delay != 0:
cur_node = 'Offset({0}, {1})'.format(cur_node, output_delay)

line = ('output-node name={0} input={1}'.format(self.name, cur_node))
ans.append((config_name, line))
return ans
Expand Down

0 comments on commit 75bed1c

Please sign in to comment.