-
Notifications
You must be signed in to change notification settings - Fork 117
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
Conversation
…ras core optimizer isnstead
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.
Thanks for the PR!
examples/keras_io/tensorflow/vision/mlp_image_classification.py
Outdated
Show resolved
Hide resolved
examples/keras_io/tensorflow/vision/mlp_image_classification.py
Outdated
Show resolved
Hide resolved
examples/keras_io/tensorflow/vision/mlp_image_classification.py
Outdated
Show resolved
Hide resolved
monitor="val_loss", patience=10, restore_best_weights=True | ||
) | ||
# Fit the model. | ||
history = model.fit( |
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.
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?
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.
I did run it for 1 epoch to test it and it runs without errors.
Test colab
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.
Surprising that it works! Maybe the XLA incompatibility doesn't always happen with extract_patches
. Thanks for checking.
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