-
Notifications
You must be signed in to change notification settings - Fork 74.4k
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
'Adam' object has no attribute 'build' (saving and loading keras.optimizers.Adam) #61915
Comments
same problem reported with Keras here: keras-team/tf-keras#46 |
@palminha Thank you for raising this issue! I was able to run the coed successfully on colab, please have a look at this gist. Thank you! |
Hi, I am Debrup. I want to work on this problem can I be pleased assigned to the problem? |
@ palminha, For MacOS we need to import optimizers from legacy space like keras.optimizers.legacy.Adam. I tried explicitly replacing the Adam with legacy .Adam and still its not working. Since there is no problem with Linux and Macos package was built and maintained by Apple itself, you need to report the issue at Apple developer forum here. Meanwhile I will also take it to the attention of concerned engineer. Thank you! |
CC - @nitins17 ,Do you have any pointers here? Thanks! |
@SuryanarayanaY Here is my machine the dependency graph: in my case i'm not using
|
@nitins17 @debrupf2946 @sushreebarsa ... @SuryanarayanaY i don't think this is a problem with |
Hi @palminha , On Arm M1, even if you use command pip install tensorflow the package installed is still Apple's package.Please find the source here. tensorflow/tensorflow/tools/pip_package/setup.py Lines 153 to 156 in f841394
If you haven't installed tensorflow-metal then you must install it since Mac package needs it to work with GPU as the above code in setup.py installs Apples package automatically if the Thanks! |
HI @SuryanarayanaY, if you check my |
Hi @palminha , Tensorflow officially supports CPU only wheels which can be installable on Macos with explicit command As confirmed in my above comment if you try
I request you to take confirmation from Apple dev forum. Thank you! |
Update: The issue got fixed in tf-nightly version. Please refer to attached logs below. Kindly note that I have metal-plugin installed so that works fine with GPU support.I am curious to know whether it works for you with CPU only.
|
@SuryanarayanaY i just tested with tf-nightly with CPU only version
it seems it solves the error
|
Thanks for confirmation. That means same package works for both. But to enable GPU support on Mac we need to install metal-plugin additionally and that works with GPU support as well. Can we mark it as resolved now. Please feel free to close the issue if you don't have further queries on this. Thank you! |
@SuryanarayanaY ... keras team closed the related issue: keras-team/tf-keras#46 |
Instead of the legacy.Adam, the tf.keras.optimizers.Adam() works well and there is no Error of Environment: OS: Macos, CPU: M2, Python3: 3.11.5, tensorflow: 2.14.0 |
I have tensorflow 2.14, I use tf.keras.optimizers.Adam but I still have the issue, when I try to load the model with pickle. :-/ Environment: OS: Macos, CPU: M2 Pro, Python 3.9.6, tensorflow: 2.14.0 |
@gszecsenyi it will be solved in version 2.15 |
The issue still exists with 2.15rc1. |
That's true. I'm using M2 Max mac. |
This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. |
This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. |
Issue type
Bug
Have you reproduced the bug with TensorFlow Nightly?
No
Source
binary
TensorFlow version
v2.13.0-rc2-7-g1cb1a030a62 2.13.0
Custom code
Yes
OS platform and distribution
MacOS ARM M1
Mobile device
No response
Python version
3.10.13
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current behavior?
When running the code below we get the following error: AttributeError: 'Adam' object has no attribute 'build'
Standalone code to reproduce the issue
Relevant log output
The text was updated successfully, but these errors were encountered: