-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
ValueError: Could not interpret optimizer identifier: <keras.src.optimizers.adam.Adam object at 0x79d9071160e0> #19262
Comments
Hi @YikunHan42 , Could you please confirm which TF version do you have? Please try with latest TF Version i.e 2.16.0rc0 which also uses Keras3. I observed similar error with Embedding layer which have changes in args in keras3. May please refer #62317. Since this is generating from Transformer Model, You need to use same TF versions that this model was built on. Could you find out which TF version this model was built upon? |
Hi, I just upgraded both tensorflow and transformers !pip show tensorflow transformers
Now the original code returns
Seemingly it's facing new compatibility issues now |
Hi @YikunHan42 , I believe this has to be fixed at Transformers repo. |
In this discussion, setting os.environ['TF_USE_LEGACY_KERAS'] = '1' solved the problem associated to Keras recent update to v3. |
What @arnoldvialfont mentioned worked for me as a palliative... |
I didn't work for me in Colab, still the same error. And am using TFDistilBertForSequenceClassification |
That means the Transformer model being used is built upon Keras2. In order to make this model work with Keras3 it has to be taken care by the concern model developer. Thanks! |
is there any way i could use keras2 ? like rollback. |
To use keras2 you need to install tf_keras package and set the environment variable TF_USE_LEGACY_KERAS to '1'.
|
This issue is stale because it has been open for 14 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 28 days. Please reopen if you'd like to work on this further. |
!pip install transformers==4.36.0 optimizer = keras.optimizers.Adam(learning_rate=LEARNING_RATE) the above code works in google colab. |
The text was updated successfully, but these errors were encountered: