Issue with save/load model in Keras
Closed this issue · 1 comments
orsharir commented
I've stumble upon a usability bug with using our layers with Keras. The save/load model functions don't play well with our layers, even when I'm using the custom_objects
optional argument. To reproduce simply build a model composed of our layers, followed by saving the model, and then loading it, e.g.:
import keras
import simnets as sk
model = # Create some model built with our layers
model.save_model('test.hdf5')
custom_objects= {
'Similarity': sk.Similarity,
'Mex': sk.Mex
}
loaded_model = keras.models.load_model('test.hdf5', custom_objects=custom_objects)
Despite the above, saving and loading just the weights does work well, so there is a temporary workaround.
elhanan7 commented
I think I fixed this. Hopefully if you import simnets.keras before loading you don't even need to specify the custom objects.
I still fail to load the model, the Lambda layers fail to load. Maybe it is a keras bug?