简体   繁体   English

Tensorflow Python:无法使用 tf.train.Saver() 恢复变量:错误::未找到:在检查点中未找到关键变量/亚当

[英]Tensorflow Python: Cannot Restore variables using tf.train.Saver(): Error::Not found: Key Variable/Adam not found in checkpoint

I am confused.我很迷惑。 I don't know what's happening.我不知道发生了什么。 I cannot restore my checkpoints.我无法恢复我的检查点。 The weird thing is sometimes I can restore them then after 1-2 hours I can't.奇怪的是有时我可以恢复它们,然后在 1-2 小时后就不能了。

I use this code to save我用这个代码来保存

saver = tf.train.Saver()
with tf.Session() as sess:
    .....
    #sess.run(init)
    saver.restore(sess, 'models/my_model_2.ckpt')

I use this code to restore我用这个代码来恢复

with tf.Session() as sess:
    #sess.run(init)
    saver.restore(sess, 'models/my_model_2.ckpt')
    ......

Error错误

2020-10-15 01:10:35.195112: W tensorflow/core/framework/op_kernel.cc:1502] OP_REQUIRES failed at 
save_restore_v2_ops.cc:184 : Not found: Key Variable/Adam not found in checkpoint

If you don't know how to fix this, just tell me if there is another way to restore variables.如果您不知道如何解决这个问题,请告诉我是否有另一种方法可以恢复变量。 Also, my program is a CNN with neural network at the end.另外,我的程序是最后带有神经网络的CNN。 Im using tensor flow for everything.我对一切都使用张量流。

change your optimizer from Adam to other?将您的优化器从 Adam 更改为其他? i don't know why,but i solve this problem by this way.我不知道为什么,但我通过这种方式解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM