Tensorflow:无法打开表文件错误 [英] Tensorflow: Unable to open table file error
本文介绍了Tensorflow:无法打开表文件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 tensorflow 1.2.0,我试图恢复已保存的模型,但收到错误:
With tensorflow 1.2.0, I am trying to restore a saved model but I receive the error:
DataLossError (see above for traceback): Unable to open table file checkpoints/saved_2/saved_2_model_1.meta: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?
[[Node: save/RestoreV2_185 = RestoreV2[dtypes=[DT_INT32], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2_185/tensor_names, save/RestoreV2_185/shape_and_slices)]]
我使用相同的 tensorflow 版本进行保存和恢复.
I am using the same tensorflow version for saving and restoring.
为了保存:
saver = tf.train.Saver()
ckpt_dir = os.path.join(params['CHK_PATH'], folder)
if not os.path.exists(ckpt_dir):
os.makedirs(ckpt_dir)
ckpt_file = os.path.join(ckpt_dir, '{}'.format(name))
path = saver.save(sess, ckpt_file)
用于恢复:
saver.restore(sess, ckpt_file)
我试过:model_saver = tf.train.Saver(write_version = saver_pb2.SaverDef.V1)
但同样的问题仍然存在.
But the same problem remains.
推荐答案
saver.restore(sess,tf.train.latest_checkpoint(ckpt_dir))
作品
这篇关于Tensorflow:无法打开表文件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文