Skip to content

Conversation

@GaofengCheng
Copy link
Contributor

Related to #1248 (by Vimal , about dropout schedule ) #1324 (some C++ level by-frame code)
This PR include: 1. config generation python code 2. shell scripts
For this stage,

  1. is done, the dropout place (drop mode) of Lstmp is updated to the newest, also fastLstmp is equipped with dropout.
  2. will updated after all the work done (schedule, combination)
Copy link
Contributor

@danpovey danpovey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small comments

self.config['non-recurrent-projection-dim'] = \
self.config['recurrent-projection-dim']

if ((self.config['dropout-proportion'] > 1.0 or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this checking code belongs in check_configs.

configs.append("component name={0}.cr_trunc type=BackpropTruncationComponent "
"dim={1} {2}".format(name, cell_dim + rec_proj_dim, bptrunc_str))
if lstm_dropout_value != -1.0:
configs.append("component name={0}.cr_trunc.dropout type=DropoutComponent dim={1} {2} {3}".format(name, cell_dim + rec_proj_dim, lstm_dropout_str, lstm_dropout_per_frame_str))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should split this line.

"dim-offset={1} dim={2}".format(name, cell_dim, rec_proj_dim))
configs.append("### End LSTM Layer '{0}'".format(name))
else:
configs.append("component-node name={0}.cr_trunc component={0}.cr_trunc "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could move the first and last of these lines out of the if-statement.


if (self.config['dropout-per-frame'] != 'false' and
self.config['dropout-per-frame'] != 'true'):
raise xparser_error("dropout-per-frame has invalid value {0}.".format(self.config['dropout-per-frame']))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change all xparser_errors to be RuntimeError. IIRC this exception type has been removed.

configs.append("component name={0}.g type=TanhComponent dim={1} {2}".format(name, cell_dim, repair_nonlin_str))
configs.append("component name={0}.h type=TanhComponent dim={1} {2}".format(name, cell_dim, repair_nonlin_str))
if lstm_dropout_value != -1.0:
configs.append("component name={0}.dropout type=DropoutComponent dim={1} {2} {3}".format(name, cell_dim, lstm_dropout_str, lstm_dropout_per_frame_str))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

watch line length. we're not being strict, but don't be ridiculous.


lstm_dropout_value = self.config['dropout-proportion']
lstm_dropout_str = 'dropout-proportion='+str(self.config['dropout-proportion'])
lstm_dropout_per_frame_value = self.config['dropout-per-frame']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this variable is unused, an since the name is longer than the rhs of the expression, there is not much need for it.

@danpovey
Copy link
Contributor

... also you should use booleans instead of strings as the config values, i.e. False, no 'false'.
But don't worry about these style issues, I'm working on this myself (relative to the 'shortcut' branch), because I want to try it myself; and I'll make a PR to show you the updated code.

@danpovey danpovey merged commit c7a7cd5 into kaldi-asr:master Feb 17, 2017
@GaofengCheng GaofengCheng deleted the dropout_scripts branch June 30, 2017 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants