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.
This commit is contained in:
Vadim Markovtsev 2017-05-01 22:58:01 +02:00 committed by Vijay Vasudevan
parent 81eef33cc4
commit 4fd0d2b5e3

View File

@ -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: