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
Custom layers #17
Comments
Thanks. Is that maybe a problem specific to Keras, i.e. can you .to_yaml and model_from_yaml() outside of Elephas? Does that work for your layer with plain Keras? |
I'm asking because the |
Thanks @maxpumperla, you are right, the model_from_yaml with custom activation function doesn't work in keras too.
Maybe this is not the right way to get the model with custom object... but I can't find an example of usage in keras documentation. |
Sure, no problem. If you really want to test this right now, fork Keras and put your special stuff there, i.e. in your case put the new activation next to the other keras activations. Then install your fork locally (cd your_keras && python setup.py install). This way there won't be a difference between custom and core. Currently I see no quick way around this. You have to "register" your custom things somewhere, otherwise functionality like |
Feel free to close, if you like |
Ok thanks, I closed this issue. |
Hi @maxpumperla I reopen this ticket because I have some news. Using a custom layer instead of custom activation function, the read from yaml works in keras but it doesn't work in elephas. I think that the problem is in spark_model.py when the model_from_yaml(..) is called during the train because it needs the custom_objects parameter. Using custom_objects parameter directly in keras works for example:
|
I've the same problem. I created a custom layer but it doesn't work. |
Alright, I will have to have a closer look at this. I'll have to see how to get the |
I have the same problem with custom loss function. Somone have a quick fix for this?? |
I will look into this - I think it will just be a matter of ensuring |
This is officially resolved in 1.2.0 - you'll just have to ensure to supply the
Same process applies for a custom layer.In the context of an estimator:
|
It seems that custom layers are not recognized in the train phase of spark model, specifically when loaded from yaml (model_from_yaml). I have tried with a custom activation function and it didn't work, the get_from_module function raised an exception "Invalid activation function: ...".
The text was updated successfully, but these errors were encountered: