-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Migrating supervised contrastive learning example to Keras 3 #1734
base: master
Are you sure you want to change the base?
Migrating supervised contrastive learning example to Keras 3 #1734
Conversation
So, the updated code is working fine with the TensorFlow backend. With other backends, like Jax, I tested, it is giving errors like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sitamgithub-MSIT Thank you for the PR!
This example can be converted to Keras 3 and it should work with all 3 backends. You will need to replace all the Tensorflow ops with Keras ops - here is a list of all Keras ops. Here is a guide for migration
The two only instances where TF methods are used are:
Now I know Another instance is this |
do you have the repro for this ValueError? For l2_normalize - please use this normalize function and set the order to 2. |
Thanks for the help! I was actually able to omit both TF instances. But other backends are showing errors. This is the modified code that worked well with Tensorflow.
But I see this set_shape is not going to work with other backends showing attribute errors. For example, jax |
Any updates on this? |
I think you can just omit |
Then it is giving this error with the TensorFlow backend |
This PR changes the Supervised Contrastive Learning example to keras 3.0 [TF-Only Example] as requested in keras-team/keras-cv#2211.
For example, here is the notebook link provided:
https://colab.research.google.com/drive/1QGiil-RpO55UNESBkilNtYETuX3B_4ZF?usp=sharing
cc: @divyashreepathihalli @fchollet
The following describes the Git difference for the changed files:
Changes: