gpt4 book ai didi

Tensorflow:无法打开表文件错误

转载 作者:行者123 更新时间:2023-12-02 18:48:15 31 4
gpt4 key购买 nike

使用tensorflow 1.2.0,我尝试恢复保存的模型,但收到错误:

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版本来保存和恢复。

保存:

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)

但同样的问题仍然存在。

最佳答案

    saver.restore(sess,tf.train.latest_checkpoint(ckpt_dir)) 

作品

关于Tensorflow:无法打开表文件错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45759757/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com