Avsecz / kopt

Hyper-parameter optimization for Keras
MIT License
47 stars 12 forks source link

Serialization for models with custom layer/loss/activation #5

Closed gokceneraslan closed 6 years ago

gokceneraslan commented 6 years ago

As described here, custom_objects argument of keras.models.load_model must be used for loading models with custom loss/layer/activation function. Adding here as a TODO item.

Avsecz commented 6 years ago
Avsecz commented 6 years ago

Maybe useful for you as well: I typically load all my own custom_objects to 'global custom objects' for convenience (you don't need to specify custom_objects in load_model then): https://github.com/gagneurlab/concise/blob/master/concise/__init__.py#L22-L27

Avsecz commented 6 years ago

I'm thinking whether it's maybe better for the user to just specify custom_objects to the global environment

from keras.utils.generic_utils import get_custom_objects
get_custom_objects()["myobject"] = myobject

I'll anyway add custom_objects to CompileFN, test_fn,

gokceneraslan commented 6 years ago

Maybe useful for you as well: I typically load all my own custom_objects to 'global custom objects' for convenience (you don't need to specify custom_objects in load_model then): https://github.com/gagneurlab/concise/blob/master/concise/__init__.py#L22-L27

I didn't know about that, very cool!

I'll anyway add custom_objects to CompileFN, test_fn,

That's also convenient, I think. Thanks!

Avsecz commented 6 years ago

closed by https://github.com/Avsecz/keras-hyperopt/pull/6