diff options
author | 2017-06-28 01:31:47 -0700 | |
---|---|---|
committer | 2017-06-28 01:36:18 -0700 | |
commit | cc4af2b6184421dff52ec9c5c0a1ad198b732d9f (patch) | |
tree | 543c03b2e8b9450084ce0ce07d1190901d17ebd8 | |
parent | 0d11e9d5b0dec2d59d481231328656dfd6dbf46e (diff) |
Support only providing save_summaries_secs to MonitoredTrainingSession.
PiperOrigin-RevId: 160382016
-rw-r--r-- | tensorflow/python/training/monitored_session.py | 20 | ||||
-rw-r--r-- | tensorflow/tools/api/golden/tensorflow.train.pbtxt | 2 |
2 files changed, 17 insertions, 5 deletions
diff --git a/tensorflow/python/training/monitored_session.py b/tensorflow/python/training/monitored_session.py index ff77470a82..e7b296374a 100644 --- a/tensorflow/python/training/monitored_session.py +++ b/tensorflow/python/training/monitored_session.py @@ -44,6 +44,10 @@ from tensorflow.python.training import session_run_hook _PREEMPTION_ERRORS = (errors.AbortedError, errors.UnavailableError) +# Value that indicates no value was provided. +USE_DEFAULT = object() + + # TODO(touts): Share that with the Supervisor. class Scaffold(object): """Structure to create or gather pieces commonly needed to train a model. @@ -269,8 +273,8 @@ def MonitoredTrainingSession(master='', # pylint: disable=invalid-name hooks=None, chief_only_hooks=None, save_checkpoint_secs=600, - save_summaries_steps=100, - save_summaries_secs=None, + save_summaries_steps=USE_DEFAULT, + save_summaries_secs=USE_DEFAULT, config=None, stop_grace_period_secs=120, log_step_count_steps=100): @@ -301,11 +305,11 @@ def MonitoredTrainingSession(master='', # pylint: disable=invalid-name save_summaries_steps: The frequency, in number of global steps, that the summaries are written to disk using a default summary saver. If both `save_summaries_steps` and `save_summaries_secs` are set to `None`, then - the default summary saver isn't used. + the default summary saver isn't used. Default 100. save_summaries_secs: The frequency, in secs, that the summaries are written to disk using a default summary saver. If both `save_summaries_steps` and `save_summaries_secs` are set to `None`, then the default summary saver - isn't used. + isn't used. Default not enabled. config: an instance of `tf.ConfigProto` proto used to configure the session. It's the `config` argument of constructor of `tf.Session`. stop_grace_period_secs: Number of seconds given to threads to stop after @@ -316,6 +320,14 @@ def MonitoredTrainingSession(master='', # pylint: disable=invalid-name Returns: A `MonitoredSession` object. """ + if save_summaries_steps == USE_DEFAULT and save_summaries_secs == USE_DEFAULT: + save_summaries_steps = 100 + save_summaries_secs = None + elif save_summaries_secs == USE_DEFAULT: + save_summaries_secs = None + elif save_summaries_steps == USE_DEFAULT: + save_summaries_steps = None + scaffold = scaffold or Scaffold() if not is_chief: session_creator = WorkerSessionCreator( diff --git a/tensorflow/tools/api/golden/tensorflow.train.pbtxt b/tensorflow/tools/api/golden/tensorflow.train.pbtxt index c295537965..89c299ae99 100644 --- a/tensorflow/tools/api/golden/tensorflow.train.pbtxt +++ b/tensorflow/tools/api/golden/tensorflow.train.pbtxt @@ -230,7 +230,7 @@ tf_module { } member_method { name: "MonitoredTrainingSession" - argspec: "args=[\'master\', \'is_chief\', \'checkpoint_dir\', \'scaffold\', \'hooks\', \'chief_only_hooks\', \'save_checkpoint_secs\', \'save_summaries_steps\', \'save_summaries_secs\', \'config\', \'stop_grace_period_secs\', \'log_step_count_steps\'], varargs=None, keywords=None, defaults=[\'\', \'True\', \'None\', \'None\', \'None\', \'None\', \'600\', \'100\', \'None\', \'None\', \'120\', \'100\'], " + argspec: "args=[\'master\', \'is_chief\', \'checkpoint_dir\', \'scaffold\', \'hooks\', \'chief_only_hooks\', \'save_checkpoint_secs\', \'save_summaries_steps\', \'save_summaries_secs\', \'config\', \'stop_grace_period_secs\', \'log_step_count_steps\'], varargs=None, keywords=None, defaults=[\'\', \'True\', \'None\', \'None\', \'None\', \'None\', \'600\', \'<object object instance>\', \'<object object instance>\', \'None\', \'120\', \'100\'], " } member_method { name: "NewCheckpointReader" |