Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensorflow - ValueError: Parent directory of trained_variables.ckpt doesn't exist, can't save

Tags:

tensorflow

I want to save my tensorflow session sess but i have the following error

ValueError: Parent directory of trained_variables.ckpt doesn't exist, can't save.

This is my line of code :

saver.save(sess, "trained_variables.ckpt")

I've also tried to change the file name and put model instead of trained_variables.ckpt but i get the same problem.

Following this tutorial A TensorFlow Tutorial: Email Classification

like image 296
bker Avatar asked Feb 09 '17 10:02

bker


3 Answers

saver.save(sess, "./trained_variables.ckpt")
like image 90
user3027221 Avatar answered Nov 04 '22 18:11

user3027221


I would guess that you're trying to save the file in a folder (directory) that doesn't exist...

Try using an absolute path for the file instead of just the bare filename.

You might want to check what your current working directory is... that could clear up things.

Does that help?

-josh

like image 13
JR Meyer Avatar answered Nov 04 '22 19:11

JR Meyer


I've put the absoluth path of the file instead of the bare filename and it worked. This is the final code

saver.save(sess, os.path.join(os.getcwd(), 'trained_variables2.ckpt'))

like image 10
bker Avatar answered Nov 04 '22 19:11

bker