-
Notifications
You must be signed in to change notification settings - Fork 33
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
Cannot deserialize Adam optimizer on M1/M2 mac #35
Comments
@sachinprasadhs, |
I tried to replicate the behavior with |
Temporarily assigned to @nkovela1. |
As an additional datapoint, the root issue here is wider spread than M1/M2 CPUs. Any attempted serialization and deserialization of legacy optimizers results in the same failure: Standalone code to reproduce the issue.
|
Hi @tomcarter23 , we actively discourage pickling for serialization/deserialization. Please try using the |
Hi, I want to be able to pickle the whole model so I can ship it across a spark cluster and keep information like the training history and the optimizer state. As far as I know this is not possible using the On every platform except for M1/M2 mac I can pickle the model and ship it across spark nodes. So currently I have to have an explicit check for a |
Hi, wondering what is happening with this |
Hi @tomcarter23, sorry for the delay. I have a pending fix, but Keras is currently undergoing an internal PR freeze in preparation for Keras to become multi-backend. I will keep you updated once I'm able to submit a fix. |
Thats great! Thanks :) |
Hi, is there any update here? |
Hi Tom, yes! A fix has been pushed and is already available on TF-nightly. It should be part of the Keras 2.15 release. Thank you again for your patience! |
Great, thanks for that! could you link the PR please? |
Sure! This is the PR: keras-team/keras#18492 |
@tomcarter23, Thank you! |
System information.
Describe the problem.
Cannot deserialize a model compiled with the
tf.keras.optimizers.Adam
optimizer on M1/M2 macs.Describe the current behavior.
When creating a Keras model on a M1/M2 mac the following messages are displayed indicating that the default optimizer
tf.keras.optimizers.Adam
runs slowly on M1/M2 macs. Keras then "falls back" to the legacy optimizertf.keras.optimizers.legacy.Adam
.Then, when serializing and trying to deserialize the model the following error is raised:
Indicating that the legacy optimizer cannot be deserialized because it does not implement the
build
attribute. On all other platforms the model can be serialized and deserialized because thetf.keras.optimizers.Adam
is used rather than the legacy version.Describe the expected behavior.
The expected behaviour is that the model can be deserialized without raising an attribute error.
Standalone code to reproduce the issue.
The text was updated successfully, but these errors were encountered: