Skip to content

Instantly share code, notes, and snippets.

@subhankar94
Created June 23, 2017 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subhankar94/0efa0a99d1223768531a65f2e5b1c673 to your computer and use it in GitHub Desktop.
Save subhankar94/0efa0a99d1223768531a65f2e5b1c673 to your computer and use it in GitHub Desktop.
restoring from checkpoint for TensorFlow v1.x
# usage: python restore_checkpoint.py model.ckpt-1000
import sys
import tensorflow as tf
ckpt = sys.argv[1]
# soft placement in case using a different system setup
config = tf.ConfigProto(allow_soft_placement=True)
with tf.Session(config=config) as sess:
new_saver = tf.train.import_meta_graph(ckpt + '.meta')
new_saver.restore(sess, ckpt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment