Tensorflow - saving and restoring from different folders

血红的双手。 提交于 2019-12-06 05:04:30

Just add save_relative_paths=True when creating tf.train.Saver():

# original code: all_saver = tf.train.Saver()
all_saver = tf.train.Saver(save_relative_paths=True)

Please refer to official doc for more details.

You could try to restore by:

with tf.Session() as sess:
    saver = tf.train.import_meta_graph(/path/to/test.meta)
    saver.restore(sess, "path/to/checkpoints/test")

In this case, because you put the name of the checkpoint is "test" so you got 3 files:

test.data-00000-of-00001
test.index
test.meta

Therefore, when you restore, you need to put the path to checkpoint folder + "/test". The system will automatically load the corresponding data and index files.

You could try to open the checkpoint file on notepad and edit it:

model_checkpoint_path: "Name-of-saver"
all_model_checkpoint_paths: "Name-of-saver"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!