Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsuccessful TensorSliceReader constructor: Failed to find any matching files for

Tags:

I tried saving my model out and then tried to restore it, but seems tensorflow is unable to find the location of the matching files :-

Code to save model output :-

import tensorflow as tf

save_file = 'model.ckpt'


weights = tf.Variable(tf.truncated_normal([2, 3]))
bias = tf.Variable(tf.truncated_normal([3]))


saver = tf.train.Saver()


with tf.Session() as sess:

    sess.run(tf.global_variables_initializer())
    saver.save(sess, save_file)

Code to restore model

import tensorflow as tf

save_file = 'model.ckpt'
tf.reset_default_graph()
weights = tf.Variable(tf.truncated_normal([2, 3]))
bias = tf.Variable(tf.truncated_normal([3]))
saver = tf.train.Saver()

with tf.Session() as sess:
    saver.restore(sess, 'model.ckpt')

I am getting below errors :-

W tensorflow/core/framework/op_kernel.cc:975] Not found: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for model.ckpt

W tensorflow/core/framework/op_kernel.cc:975] Not found: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for model.ckpt

like image 648
Schumi08 Avatar asked Feb 05 '17 15:02

Schumi08


1 Answers

The saver.restore() method will fail unless you pass a path—and not just a filename—as the second argument. To work around this problem, you can call saver.restore(sess, './model.ckpt') if you are running the script from the directory containing the checkpoint.

like image 191
mrry Avatar answered Sep 21 '22 09:09

mrry