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? #13

Open
ghost opened this issue Nov 4, 2018 · 5 comments
Open

Continue training? #13

ghost opened this issue Nov 4, 2018 · 5 comments

Comments

@ghost
Copy link

ghost commented Nov 4, 2018

I am using linux and my everytime i run the code it starts the training all over from the beginning. How do i continue training?

@Utayaki
Copy link

Utayaki commented Nov 4, 2018

Use model = load_model('REAL.hdf5') and model.save('REAL.hdf5')

@ghost
Copy link
Author

ghost commented Nov 5, 2018

Use model = load_model('REAL.hdf5') and model.save('REAL.hdf5')

Sorry, but I'm new and I'm not really familiar with Keras. My question is, is the REAL.hdf5 the same thing as the weight generated during each checkpoint? Is it any different with files generated by model.save?

@Utayaki
Copy link

Utayaki commented Nov 5, 2018

Use model = load_model('REAL.hdf5') and model.save('REAL.hdf5')

Sorry, but I'm new and I'm not really familiar with Keras. My question is, is the REAL.hdf5 the same thing as the weight generated during each checkpoint? Is it any different with files generated by model.save?

Real.hdf5 is a name of MODEL, note weight. That's just the name of the model. And the code model.save gives you an opportunity to save it. And the next time you can load it with load.model(*name of your model*)

My code now looks like

`#保存とする調整

model = load_model('Real.hdf5')


history = model.fit(network_input, network_output, epochs=36, batch_size=2048, validation_split=0.2, callbacks=callbacks_list)


model.save('Real.hdf5')`

@ashokrs
Copy link

ashokrs commented Dec 10, 2018

Thanks to @Utayaki . I was hit wit hthe same problem last night. Following the hint from @Utayaki , this is how I solved it.

  1. Made this change first
    #from keras.models import Sequential
    from keras.models import Sequential, load_model
  2. In "train" function, changed reference to filepath:
    #filepath = "weights-improvement-{epoch:02d}-{loss:.4f}-bigger.hdf5"
    filepath = "Real.hdf5"
  3. Couple of lines below, in the same "train" function, did this
    model = load_model('Real.hdf5')
    model.fit(network_input, network_output, epochs=200, batch_size=64, callbacks=callbacks_list)
    model.save('Real.hdf5')

This enabled me to save the model as "Real.hdf5". When the # of epochs runs completes. Copy "Real.hdf5" as "weights.hdf5" and run "python3 predict.py" to generate the output knowing the cost functions reflecting the error rate. Closer to ZERO provides a better result.

If you want to continue the training, just restart by running "python3 lstm.py".

good luck!

@binary-person
Copy link

Made a pull request for this: #26

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