Skip to content

Commit

Permalink
[build,scripts] Fix to fast-lstm xconfig layer which was not function…
Browse files Browse the repository at this point in the history
…al; cosmetic change to 'configure'.
  • Loading branch information
danpovey committed Aug 11, 2017
1 parent 1a508c3 commit 8e269d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions egs/wsj/s5/steps/libs/nnet3/xconfig/lstm.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,19 +637,23 @@ def generate_lstm_config(self):
configs.append("# See cu-math.h:ComputeLstmNonlinearity() for details.")
configs.append("component name={0}.lstm_nonlin type=LstmNonlinearityComponent cell-dim={1} {2}".format(name, cell_dim, lstm_str))
configs.append("# Component for backprop truncation, to avoid gradient blowup in long training examples.")
# Note from Dan: I don't remember why we are applying the backprop
# truncation on both c and m appended together, instead of just on c.
# Possibly there was some memory or speed or WER reason for it which I
# have forgotten about now.
configs.append("component name={0}.cm_trunc type=BackpropTruncationComponent dim={1} {2}".format(name, 2 * cell_dim, bptrunc_str))

configs.append("### Nodes for the components above.")
configs.append("component-node name={0}.four_parts component={0}.W_all input=Append({1}, "
"IfDefined(Offset({0}.r_trunc, {2})))".format(name, input_descriptor, delay))
"IfDefined(Offset({0}.c_trunc, {2})))".format(name, input_descriptor, delay))
configs.append("component-node name={0}.lstm_nonlin component={0}.lstm_nonlin "
"input=Append({0}.four_parts, IfDefined(Offset({0}.c_trunc, {1})))".format(name, delay))
# we can print .c later if needed, but it generates a warning since it's not used. could use c_trunc instead
#configs.append("dim-range-node name={0}.c input-node={0}.lstm_nonlin dim-offset=0 dim={1}".format(name, cell_dim))
configs.append("dim-range-node name={0}.m input-node={0}.lstm_nonlin dim-offset={1} dim={1}".format(name, cell_dim))
configs.append("component-node name={0}.cm_trunc component={0}.cm_trunc input={0}.lstm_nonlin".format(name))
configs.append("dim-range-node name={0}.c_trunc input-node={0}.cm_trunc dim-offset=0 dim={1}".format(name, cell_dim))
configs.append("dim-range-node name={0}.m_trunc input-node={0}.cm_trunc dim-offset={1} dim={1}".format(name, cell_dim))
# configs.append("dim-range-node name={0}.m_trunc input-node={0}.cm_trunc dim-offset={1} dim={1}".format(name, cell_dim))
configs.append("### End LTSM layer '{0}'".format(name))
return configs

Expand Down
3 changes: 2 additions & 1 deletion src/configure
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ Configuration options:
--shared Build and link against shared libraries [default=no]
--use-cuda Build with CUDA [default=yes]
--cudatk-dir=DIR CUDA toolkit directory
--double-precision Build with double precision floats [default=no]
--double-precision Build with BaseFloat set to double if yes [default=no],
mostly useful for testing purposes.
--static-fst Build with static OpenFst libraries [default=no]
--fst-root=DIR OpenFst root directory [default=../tools/openfst/]
--fst-version=STR OpenFst version string
Expand Down

0 comments on commit 8e269d0

Please sign in to comment.