From 0237e86297087ba3e700ac9218f846e6e662c60f Mon Sep 17 00:00:00 2001 From: Jianwei Xie Date: Wed, 2 May 2018 15:36:54 -0700 Subject: Adds the EvalListener support for run_local. PiperOrigin-RevId: 195163507 --- tensorflow/python/estimator/training.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tensorflow/python/estimator/training.py') diff --git a/tensorflow/python/estimator/training.py b/tensorflow/python/estimator/training.py index 534c357067..41ffa371aa 100644 --- a/tensorflow/python/estimator/training.py +++ b/tensorflow/python/estimator/training.py @@ -656,6 +656,11 @@ class _TrainingExecutor(object): max_steps=self._train_spec.max_steps, hooks=train_hooks) + if not self._continuous_eval_listener.before_eval(): + logging.info('Exiting training and evaluation lopp, as requested by ' + '_ContinuousEvalListener.before_eval.') + break + # Final export signal: For any eval result with global_step >= train # max_steps, the evaluator will send the final export signal. The # _should_stop_local_train will then end the while True as the stopping @@ -669,6 +674,11 @@ class _TrainingExecutor(object): raise RuntimeError('There was no new checkpoint after the training. ' 'Eval status: {}'.format(eval_result.status)) + if not self._continuous_eval_listener.after_eval(eval_result): + logging.info('Exiting evaluation, as requested by ' + '_ContinuousEvalListener.after_eval.') + break + if _should_stop_local_train( eval_result.metrics[ops.GraphKeys.GLOBAL_STEP]): break -- cgit v1.2.3