Open boloson opened 7 years ago
Same issue (Not found: ; No such file or directory). Apparently, it tries to look for the file before creating it.
running on a windows machine, change line : saver.save(sess, "spikes.ckpt") to saver.save(sess, "./spikes.ckpt") resulted in successful save of the checkpoint
saver.save(sess, "spikes.ckpt")
This line raises the error:
ValueError: Parent directory of spikes.ckpt doesn't exist, can't save.
It's pretty clear the parameter is asking for a path and not just a file name. So please fix the code into the format as @roip suggested or into a sub-directory format like this:
saver.save(sess, "train_saves\spikes.ckpt")
I had to use "./spikes.ckpt"
except for "Parent directory of spikes.ckpt doesn't exist", on windows and spyder, the following error happened:
... shape_and_slices=shape_and_slices, tensors=tensors, name=name) File "e:\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "e:\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 3290, in create_op op_def=op_def) File "e:\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 1654, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
FailedPreconditionError (see above for traceback): Attempting to use uninitialized value Variable [[Node: save_7/SaveV2 = SaveV2[dtypes=[DT_BOOL, DT_BOOL, DT_BOOL, DT_BOOL, DT_BOOL, DT_BOOL, DT_BOOL, DT_BOOL, DT_BOOL, DT_BOOL, DT_BOOL, DT_BOOL, DT_BOOL, DT_BOOL], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save_7/Const_0_0, save_7/SaveV2/tensor_names, save_7/SaveV2/shape_and_slices, Variable, Variable_1, Variable_2, Variable_3, Variable_4, spikes, spikes_1, spikes_2, spikes_3, spikes_4, spikes_5, spikes_6, spikes_7, spikes_8)]] ...
I also doubt this is the spyder's problem because it works on python console.
adding the following in spyder has fixed the problem! (including any file eg. loading variable)
tf.reset_default_graph()
saver.save(sess, "spikes.ckpt") doesn't work
require running tf.global_variables_initializer() for newer version of Tensorflow
sess = tf.InteractiveSession() init = tf.global_variables_initializer() sess.run(init)
raw_data = [1., 2., 8., -1., 0., 5.5, 6., 13] spikes = tf.Variable([False] * len(raw_data), name='spikes') spikes.initializer.run()
saver = tf.train.Saver()