Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

continue training after crash #8

Open
vinnitu opened this issue Jan 9, 2017 · 2 comments
Open

continue training after crash #8

vinnitu opened this issue Jan 9, 2017 · 2 comments

Comments

@vinnitu
Copy link

vinnitu commented Jan 9, 2017

When I train seq2seq in tensorflow in examples (an rnn in darknet) I use backup between epochs

But I don't sure keras_spell.py save model from time to time, how can I do it in properly way?

@parth126
Copy link

@vinnitu Adding this at the end of for loop in iterate_training function should do the trick
model.save_weights('SpellModel_{0}.h5'.format(iteration))
This will save the weights after each iteration. One iteration may have more than one epoch.

If you want to save it after each epoch instead, make sure that each iteration has only one epoch.
You could also you keras callback function ModelCheckpoint (https://keras.io/callbacks/).

You will also have to save the model itself once. Add the following snippet in generate_model function.

model_json = model.to_json()
with open("SpellModel.json", "w") as json_file:
json_file.write(model_json)

Later you can load the model from this json file and then load the weights from your checkpoint.
Look https://keras.io/models/about-keras-models/ for details

@MajorTal
Copy link
Owner

MajorTal commented Feb 28, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants