Skip to content
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

Image classification with modern MLP models - Converted to Keras core by : @divyashreepathihalli #368

Merged
merged 5 commits into from
Jun 21, 2023

Conversation

divyashreepathihalli
Copy link
Collaborator

@divyashreepathihalli divyashreepathihalli commented Jun 16, 2023

fixed imports
removed tf- addons dependency
replaced tfa GELU layer with keras_core.Layers.Lambda and tf.nn.gelu
replaced tfa AdamW optimizer with Keras-core AdamW optimizer

Copy link
Member

@fchollet fchollet left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

monitor="val_loss", patience=10, restore_best_weights=True
)
# Fit the model.
history = model.fit(
Copy link
Member

Choose a reason for hiding this comment

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

I'd be surprised if this worked as-is, since one of the layers is using extract_patches which is not XLA compatible, and fit() will default to using XLA. Did you try running it end to end?

Copy link
Collaborator Author

@divyashreepathihalli divyashreepathihalli Jun 21, 2023

Choose a reason for hiding this comment

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

I did run it for 1 epoch to test it and it runs without errors.
Test colab
Screenshot 2023-06-20 at 10 29 46 PM

Copy link
Member

@fchollet fchollet left a comment

Choose a reason for hiding this comment

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

Surprising that it works! Maybe the XLA incompatibility doesn't always happen with extract_patches. Thanks for checking.

@fchollet fchollet merged commit 506cc99 into main Jun 21, 2023
@divyashreepathihalli divyashreepathihalli deleted the divya_mlp_models branch June 21, 2023 18:55
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.

2 participants