tensorflow-mnist-predict
tensorflow-mnist-predict copied to clipboard
Can't save the model
Hello,
I'm trying your scripts, but i can predict any numbers because when i run create_model1 or create_model2. They finish because they can't save the model. Here the error code :
Traceback (most recent call last):
File "create_model_1.py", line 61, in <module>
save_path = saver.save(sess, "model1.ckpt"')
File "C:\Users\Laura\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\training\saver.py", line 1365, in save
"Parent directory of {} doesn't exist, can't save.".format(save_path))
ValueError: Parent directory of model1.ckpt doesn't exist, can't save.
Thanks. Jordan
Hey, I am having the same issue, did you resolve it?
No sry. I abandon this project.
cheers
hey, first check whether the save_path is within the with tf.Session() as sess block, coz if its outside it then it would consider that the session is closed. Secondly, if the problem still persists then try adding import os.path and then add these lines to code
with tf.Session() as sess:
" same in the code"
save_path=saver.save(sess, os.path.join(os.getcwd(), 'model.ckpt'))
print ("Model saved in file: ", save_path)
This will give the absolute path of the the file.
If these don't work then , u could create a variable model_path='/tmp/model.ckpt' then save_path=saver.save(sess, model_path)
You need to provide a full path to model.ckpt. Try with the full path where the file is (ex: your workspace).
Hello.
I had the same error.
Here's what you can do!
Have a great day!
save_path = saver.save(sess, "model.ckpt") to save_path = saver.save(sess, "./model.ckpt")