From 4fd0d2b5e340244dc413b23d54605dfcfcf857bb Mon Sep 17 00:00:00 2001 From: Vadim Markovtsev Date: Mon, 1 May 2017 22:58:01 +0200 Subject: [PATCH] tf.train.Saver: be verbose about ckpt load errors (#9335) I've just had an AbortedError which resulted in the following log: ``` WARNING:tensorflow:/path/to/checkpoint WARNING:tensorflow:/path/to/checkpoint: Checkpoint ignored ``` With this addition, I get ``` WARNING:tensorflow:tensorflow.python.framework.errors_impl.AbortedError: /path/to/checkpoint WARNING:tensorflow:/path/to/checkpoint: Checkpoint ignored ``` which is a bit nicer. --- tensorflow/python/training/saver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow/python/training/saver.py b/tensorflow/python/training/saver.py index 43b61742467..3ec6692f2cb 100644 --- a/tensorflow/python/training/saver.py +++ b/tensorflow/python/training/saver.py @@ -935,11 +935,11 @@ def get_checkpoint_state(checkpoint_dir, latest_filename=None): ckpt.all_model_checkpoint_paths[i] = os.path.join(checkpoint_dir, p) except errors.OpError as e: # It's ok if the file cannot be read - logging.warning(str(e)) + logging.warning("%s: %s" % (type(e).__name__, e)) logging.warning("%s: Checkpoint ignored", coord_checkpoint_filename) return None except text_format.ParseError as e: - logging.warning(str(e)) + logging.warning("%s: %s" % (type(e).__name__, e)) logging.warning("%s: Checkpoint ignored", coord_checkpoint_filename) return None finally: