Load session from checkpoint
saver = tf.train.Saver()
ckpt = self.get_checkpoint_state()
if ckpt and ckpt.model_checkpoint_path:
print("\n:: restoring checkpoint from", ckpt.model_checkpoint_path, "\n")
saver.restore(self._sess, ckpt.model_checkpoint_path)
print("session restored")
After Change
def load(self):
if self.load_path:
if isinstance(self.load_path, Path) and self.load_path.parent.is_dir():
if tf.train.get_checkpoint_state(self.load_path.parent) is not None:
saver = tf.train.Saver()
print("Restore NerNetwork model from {}".format(str(self.load_path)))
saver.restore(self._sess, str(self.load_path))