-
Notifications
You must be signed in to change notification settings - Fork 27.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
Transformers need keras updates for tf-nightly + tf_keras (Keras 2.0) & keras 3.0 #27377
Comments
Hi @jojivk, thanks for raising this issue! We don't officially support nightly releases as they're not guaranteed to be stable. Our versions of tensorflow and keras are pinned because automatically installing the latest release tends to lead to many breaking changes. If there is a change in the import structure in a stable release, then it's something we could try to handle and of course help from the community on this is always welcome :) |
Hi @amyeroberts Thanks for the quick response. Keras 3.0 will be default (default now in nightly) with TF 2.16 release. Also, to fall back to using keras 2.0 with TF 2.16, few fixes that I mentioned, is needed. |
Hi @jojivk, yes, we're aware of the issues! We're going to stick to the version pin for now until 2.16 is more stable and we can test it properly. Our long-term plan here is:
|
@Rocketknight1 Thanks for the update |
Quick update for this issue, we've filed our first big PR to prepare for Keras 3 / keras-nightly at #27794. There's likely more work to be done after this, but this resolves one major blocker. |
@Rocketknight1 . Thanks for the update and fixes. I will update on any issues we see. |
@Rocketknight1 @amyeroberts. Thank you for all the fixes!
We fixed it locally (as below) to use with Keras2.0 Models, due to reasons mentioned above in the issue report. Other similar imports: which as of now we are not sure if it is an issue. from tensorflow.keras.callbacks import Callback |
Hi @jojivk - yep, we noted those too! I think we're going to remove all instances of |
@Rocketknight1 . Thank you for the update!. |
Prefer using |
Thanks @fchollet! We'll use that pattern instead. |
@Rocketknight1 |
You shouldn't need to change any settings @jojivk73. If you install The full transition to Keras 3 will be trickier. The reason for this is that all of our model code is written for TF/Keras, and mixes Keras layers with TF ops. To work in Keras 3, this code will need to replace all the TF ops with Our two options are:
Either way, we'll need a big community push to port all the models to |
@Rocketknight1 Thanks for the quick and detailed reply. |
System Info
With new changes for Keras (https://groups.google.com/g/keras-users/c/jgGcX730WGE), we are seeing issues with using Huggingface models (GPT-J, Stable Diffusion, & Vision Transformer). We saw that transformers restrict the versions for Tensorflow and Keras. https://github.com/huggingface/transformers/blob/main/setup.py#L129.
To use the models with tf-keras (keras 2.0), we could resolve issues in Transformers by changing import of keras in transformers to import tf_keras. -ie change
import keras.*
to
import tf_keras.*
Who can help?
No response
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Expected behavior
Fails to run
The text was updated successfully, but these errors were encountered: