Skip to content

Commit

Permalink
Add more logging to trial actions.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 274705183
  • Loading branch information
Jonathan Shen authored and Copybara-Service committed Oct 15, 2019
1 parent 7f52ca9 commit 8926ece
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lingvo/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@
'evaler_dev and decoder_dev will only match the corresponding '
'jobs that are on the dev set.')


@tf.flags.validator('vizier_reporting_job')
def _ValidateVizierReportingJob(value):
if value in ['evaler', 'decoder']:
return True
if value.startswith('evaler_') or value.startswith('decoder_'):
return True
raise tf.flags.ValidationError('Invalid value %s for vizier_reporting_job' %
value)


tf.flags.DEFINE_integer(
'enqueue_max_steps', None, 'Max enqueue steps. -1 meaning no limit.'
' This flag should be set for unit-test only.')
Expand Down Expand Up @@ -995,6 +1006,7 @@ def _Loop(self):
self.EvalLatestCheckpoint(path)

if self._should_report_metrics:
tf.logging.info('Reporting trial done.')
self._trial.ReportDone()
tf.logging.info('Evaluation finished.')

Expand Down Expand Up @@ -1067,6 +1079,7 @@ def _EvalOnce(self, path, sess):

should_stop = global_step >= self.params.train.max_steps
if self._should_report_metrics:
tf.logging.info('Reporting eval measure for step %d.' % global_step)
trial_should_stop = self._trial.ReportEvalMeasure(global_step,
metrics_dict, path)
should_stop = should_stop or trial_should_stop
Expand Down Expand Up @@ -1184,6 +1197,7 @@ def _Loop(self):
self.DecodeLatestCheckpoint(path)

if self._should_report_metrics:
tf.logging.info('Reporting trial done.')
self._trial.ReportDone()
tf.logging.info('Decoding finished.')

Expand Down Expand Up @@ -1263,6 +1277,7 @@ def DecodeCheckpoint(self, sess, checkpoint_path):

should_stop = global_step >= self.params.train.max_steps
if self._should_report_metrics:
tf.logging.info('Reporting eval measure for step %d.' % global_step)
trial_should_stop = self._trial.ReportEvalMeasure(global_step,
dec_metrics,
checkpoint_path)
Expand Down

0 comments on commit 8926ece

Please sign in to comment.