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
Keras load_model command error : 'NoneType' object has no attribute 'get' #11418
Comments
Please provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short). |
Also having this issue. Are you using a Lambda layer in your Sequential model? I've never had an issue with keras.model.load_model(path) until I made a model that has a Lambda layer. |
Having exactly the same problem with you! Tensorflow 1.12.0 with tf.keras backend |
Is this still an issue? If not close the issue. If you still have this issue, Please provide a code to reproduce the bug. Thanks! |
Also having this, and my model includes Lambda layers. I've noticed that when the function "in" the Lambda layer refers to a class method, things don't work nicely. That inner function seems to need to refer to a named, static Python function. I've also noticed additional oddities, like the functions in question not being able to find imports defined in the same file upon deserialization (load_model). In general, it seems like support for exotic kinds of Python functions within the Lambda(...) doesn't play very nicely with Keras serialization. |
Please fill the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Along with the template, please provide as many details as possible to find the root cause of the issue. It would be great if you can provide a small code to reproduce the error. Thanks! |
It looks like you haven't used a template to create this issue. Please resubmit your issue using a template from here. We ask users to use the template because it reduces overall time to resolve a new issue by avoiding extra communication to get to the root of the issue. We will close this issue in lieu of the new one you will create from the template. Thank you for your cooperation. |
In case it helps anyone else having this issue: my solution was to use the In model definition: x = tf.keras.layers.Lambda(self.lamba_function)(x) Later, when loading the same model: keras.models.load_model(filename, custom_objects={'lamba_function': self.lamba_function} |
I'm having this issue after updating keras to 2.2.4. I have a python lambda function at my loss function, and using "load_model" with argument "custom_objects" won't help. I was wondering if there is any other ways to deal with this issue besides only saving weights (discard the model structure). |
Please make sure that the boxes below are checked before you submit your issue.
If your issue is an implementation question, please ask your question on StackOverflow or on the Keras Slack channel instead of opening a GitHub issue.
Thank you!
Check that you are up-to-date with the master branch of Keras. You can update with:
pip install git+git://github.com/keras-team/keras.git --upgrade --no-deps
Check that your version of TensorFlow is up-to-date. The installation instructions can be found here.
Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).
The text was updated successfully, but these errors were encountered: