datastories-semeval2017-task4 icon indicating copy to clipboard operation
datastories-semeval2017-task4 copied to clipboard

save model

Open Matt2121rt opened this issue 7 years ago • 1 comments

Dear cbaziotis,

I was able to run all your code for the subtask A and then I saved the nn_model in a h5 file.

However, when I tried to load it with the following code:

from keras.models import load_model model = load_model('my_model2.h5')

I get "ValueError: Invalid layer: Attention"

If by chance you know how to solve this issue, I would really really appreciate

Thank you in advance

Matt

Matt2121rt avatar Oct 16 '17 09:10 Matt2121rt

Hi Matt, Could you please pull from the master and try again?

Also, in case you are not aware of this, when loading a model with custom layers, you have to pass the layers' Class in load_model. Look at this for an example https://github.com/cbaziotis/hierarchical-rnn-biocreative-4/blob/master/models/submissions/submission.py#L79

Please let me know if this solves your problem.

cbaziotis avatar Jun 08 '18 17:06 cbaziotis