tensorflow-mnist-predict icon indicating copy to clipboard operation
tensorflow-mnist-predict copied to clipboard

Can't save the model

Open Jordan-Volcano opened this issue 8 years ago • 5 comments

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

Jordan-Volcano avatar Mar 04 '17 21:03 Jordan-Volcano

Hey, I am having the same issue, did you resolve it?

milapj avatar Mar 20 '17 09:03 milapj

No sry. I abandon this project.

cheers

Jordan-Volcano avatar Mar 20 '17 10:03 Jordan-Volcano

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)

robotrickz avatar Apr 17 '17 11:04 robotrickz

You need to provide a full path to model.ckpt. Try with the full path where the file is (ex: your workspace).

Link009 avatar Jul 05 '17 10:07 Link009

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")

mgh3326 avatar Nov 06 '18 10:11 mgh3326