Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e97df65
dropout_schedule: Adding dropout schedule to scripts
vimalmanohar Dec 5, 2016
8d26ce0
dropout_schedule: Add set-dropout-proportion in nnet3 utils
vimalmanohar Dec 6, 2016
1424c57
Changing option
vimalmanohar Dec 7, 2016
818d495
dropout_schedule: Print dropout info
vimalmanohar Dec 7, 2016
3342dd8
dropout_schedule: Adding more comments and fixing bug
vimalmanohar Dec 7, 2016
f17b0fc
dropout_schedule: Bug fix
vimalmanohar Dec 8, 2016
5a6a9b1
dropout_schedule: Fixed bug
vimalmanohar Dec 8, 2016
4ece089
dropout_schedule: Fixing logging
vimalmanohar Dec 9, 2016
0dd66c1
dropout_schedule: Not printing shrinkage when its 1.0
vimalmanohar Dec 9, 2016
f6d25a2
Merging
vimalmanohar Dec 11, 2016
635bb6e
Merge branch 'master' of github.com:kaldi-asr/kaldi into dropout_sche…
vimalmanohar Dec 11, 2016
7109c43
change dropout_parser strategy
GaofengCheng Dec 12, 2016
5435f23
adding frame level dropout to TDNN+LSTM on AMI SDM1 #1248
GaofengCheng Dec 14, 2016
7899760
dropout_schedule: Add strict checking of dropout schedule
vimalmanohar Dec 14, 2016
18404a9
Merge branch 'dropout_schedule' into nnet3-dropout
vimalmanohar Dec 15, 2016
4371f7a
Merge pull request #6 from GaofengCheng/nnet3-dropout
vimalmanohar Dec 15, 2016
c86b3e4
dropout_schedule: Better way to fix the same data proportion in sched…
vimalmanohar Dec 15, 2016
bc72ed6
dropout_schedule: SetDropoutProportion to 0 in nnet-combine and nnet-…
vimalmanohar Dec 16, 2016
879e2e1
dropout_schedule: Adding back the function SetDropoutProportion that …
vimalmanohar Dec 16, 2016
18a5c58
dropout_schedule: Fixing deprecated dropout option
vimalmanohar Dec 16, 2016
d7ebc31
dropout_schedule: Sorting models to combine for easy reading of values
vimalmanohar Dec 16, 2016
8484c58
dropout_schedule: Merging from master
vimalmanohar Dec 28, 2016
a01ed13
dropout: Minor bug fix
vimalmanohar Jan 9, 2017
e6d886a
dropout_schedule: Simplying dropout in script
vimalmanohar Jan 19, 2017
4e8960b
dropout_schedule: Simplified dropout schedule functions
vimalmanohar Jan 21, 2017
a6b9389
dropout_schedule: removing example script
vimalmanohar Jan 21, 2017
df7e7b6
dropout_schedule: fixing minor errors
vimalmanohar Jan 21, 2017
c978be3
dropout_schedule: Made functions internal
vimalmanohar Jan 21, 2017
e9d498b
dropout_schedule: Added self test
vimalmanohar Jan 23, 2017
d8adee9
dropout_schedule: removing dropout option
vimalmanohar Jan 23, 2017
09cc27b
dropout_schedule: Add more examples
vimalmanohar Jan 23, 2017
2e94018
dropout_schedule: Made self_test to not run on import
vimalmanohar Jan 23, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions egs/wsj/s5/steps/libs/nnet3/train/chain_objf/acoustic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ def train_one_iteration(dir, iter, srand, egs_dir,
leaky_hmm_coefficient,
momentum, max_param_change, shuffle_buffer_size,
frame_subsampling_factor, truncate_deriv_weights,
run_opts, background_process_handler=None):
run_opts,
dropout_edit_string="",
background_process_handler=None):
""" Called from steps/nnet3/chain/train.py for one iteration for
neural network training with LF-MMI objective

Expand All @@ -237,9 +239,10 @@ def train_one_iteration(dir, iter, srand, egs_dir,
if os.path.exists('{0}/srand'.format(dir)):
try:
saved_srand = int(open('{0}/srand'.format(dir)).readline().strip())
except (IOError, ValueError) as e:
raise Exception("Exception while reading the random seed "
"for training: {0}".format(e.str()))
except (IOError, ValueError):
logger.error("Exception while reading the random seed "
"for training")
raise
if srand != saved_srand:
logger.warning("The random seed provided to this iteration "
"(srand={0}) is different from the one saved last "
Expand Down Expand Up @@ -302,6 +305,17 @@ def train_one_iteration(dir, iter, srand, egs_dir,
cur_num_chunk_per_minibatch = num_chunk_per_minibatch / 2
cur_max_param_change = float(max_param_change) / math.sqrt(2)

raw_model_string = '{0} {1}'.format(raw_model_string, dropout_edit_string)

shrink_info_str = ''
if shrinkage_value != 1.0:
shrink_info_str = ' and shrink value is {0}'.format(shrinkage_value)

logger.info("On iteration {0}, learning rate is {1}"
"{shrink_info}.".format(
iter, learning_rate,
shrink_info=shrink_info_str))

train_new_models(dir=dir, iter=iter, srand=srand, num_jobs=num_jobs,
num_archives_processed=num_archives_processed,
num_archives=num_archives,
Expand Down Expand Up @@ -521,7 +535,7 @@ def combine_models(dir, num_iters, models_to_combine, num_chunk_per_minibatch,

models_to_combine.add(num_iters)

for iter in models_to_combine:
for iter in sorted(models_to_combine):
model_file = '{0}/{1}.mdl'.format(dir, iter)
if os.path.exists(model_file):
raw_model_strings.append(
Expand Down
29 changes: 28 additions & 1 deletion egs/wsj/s5/steps/libs/nnet3/train/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
import shutil

import libs.common as common_lib
import libs.nnet3.train.dropout_schedule as dropout_schedule
from dropout_schedule import *
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 it would be better if you just imported get_dropout_edit_string, because that's the only function we need from there, and if you just import the one function it's clear that that's the only one that's the real interface. You could rename all the others with underscores at the start of their names (assuming they really are internal to the module and assuming that's what the Google style guide recommends in such circumstances).


logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())


class RunOpts:
class RunOpts(object):
"""A structure to store run options.

Run options like queue.pl and run.pl, along with their memory
Expand Down Expand Up @@ -530,6 +532,31 @@ def __init__(self):
Note: we implemented it in such a way that it
doesn't increase the effective learning
rate.""")
self.parser.add_argument("--trainer.dropout-schedule", type=str,
action=common_lib.NullstrToNoneAction,
dest='dropout_schedule', default=None,
help="""Use this to specify the dropout
schedule. You specify a piecewise linear
function on the domain [0,1], where 0 is the
start and 1 is the end of training; the
function-argument (x) rises linearly with the
amount of data you have seen, not iteration
number (this improves invariance to
num-jobs-{initial-final}). E.g. '0,0.2,0'
means 0 at the start; 0.2 after seeing half
the data; and 0 at the end. You may specify
the x-value of selected points, e.g.
'0,0.2@0.25,0' means that the 0.2
dropout-proportion is reached a quarter of the
way through the data. The start/end x-values
are at x=0/x=1, and other unspecified x-values
are interpolated between known x-values. You
may specify different rules for different
component-name patterns using 'pattern1=func1
pattern2=func2', e.g. 'relu*=0,0.1,0
lstm*=0,0.2,0'. More general should precede
less general patterns, as they are applied
sequentially.""")

# General options
self.parser.add_argument("--stage", type=int, default=-4,
Expand Down
Loading