Skip to content

Example (nl_image_search.py) update to work with newer version of TF in Keras 2 compat mode. #2085

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

vinayak19th
Copy link

Multiple Bug fixes for the code to be usable with newer tf versions (tested with 2.19.0) under keras 2 compat mode :
Change log:

  • Removed TF-Addons as it doesn't work with newer version and was only being used for the AdamW optimizer which is part of keras natively now
  • Fixed tf.nn.gelu call : Changed tf.nn.gelu -> tf.keras.activations.gelu so that modern keras 2 backward compat can use it within the model api
  • Updated the hub.KerasLayer calls to use the correct arguments
  • Update training code to include steps per epoch : Updated the training code to have steps_per_epoch as a variable so that model.fit can show the total steps
  • Fixed file loading and delete paths : Fixed the file paths to reflect the effect of the newer unzip process

@vinayak19th vinayak19th changed the title Patch 2 Compatibility fixed to work with newer versions of TF under Keras 2 backward compatibility mode Apr 12, 2025
@vinayak19th vinayak19th changed the title Compatibility fixed to work with newer versions of TF under Keras 2 backward compatibility mode Example (nl_image_search.py) update to work with newer version of TF in Keras 2 compat mode. Apr 12, 2025
Copy link
Contributor

@divyashreepathihalli divyashreepathihalli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update this example for keras 3?

@vinayak19th
Copy link
Author

Can you update this example for keras 3?

I was having an issue with the BERT model, but I can try fixing that later

Updated tf.keras calls to keras calls and formated tf hub call
Replaced all tf.keras calls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants