NeuroNER icon indicating copy to clipboard operation
NeuroNER copied to clipboard

loading saved models

Open ArmandGiraud opened this issue 7 years ago • 4 comments

Hello Franck, First of all thanks for providing this great tool!

I found that saving the model to disk gave me 3 files instead of 1 model_000.ckpt.index and model_000.ckpt.index. I had to add a line on the train.py lines model_saver = tf.train.import_meta_graph(pretrained_model_checkpoint_filepath +'.meta') just before model_saver.restore(sess,pretrained_model_checkpoint_filepath) line 130 and 140. This is a just a trick explained here I saw as well that you changed the trained_model_checkpoint_filepath parameter in an update, but left it unchanged in the pretrained model. But I think it's not a problem.

Thanks again for this Repo! It makes it really easy to train and tune a good model!

ArmandGiraud avatar Jun 16 '17 19:06 ArmandGiraud

I'm having the same problem but your solution didn't work in my case. Somehow the model I trained is recorded in pieces -one piece for each epoch, I suppose- and they are not gathered in one file, which I don't know why -being not very familiar with tensorflow.

dicleoztur avatar Jun 28 '17 14:06 dicleoztur

Somehow the model I trained is recorded in pieces -one piece for each epoch, I suppose- and they are not gathered in one file, which I don't know why -being not very familiar with tensorflow.

That's intended. The model is saved for each epoch, i.e. there is one saved model for each epoch. You have to choose which epoch/model you prefer to use. E.g., you could choose the epoch/model with the best performances on valid set.

Franck-Dernoncourt avatar Jun 28 '17 14:06 Franck-Dernoncourt

yes, sure! it is my ignorance.. : ) i thought in the end one model file is generated out of what is best learned throughout the epoches. using the best model, now everything works without a problem. thanks!

dicleoztur avatar Jun 29 '17 13:06 dicleoztur

No worries, it's better to use the GitHub Q&A/issues than being stuck :-)

Franck-Dernoncourt avatar Jun 29 '17 19:06 Franck-Dernoncourt