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

Training discrepancy between Keras 2 and 3 #20507

Open
matemijolovic opened this issue Nov 16, 2024 · 2 comments
Open

Training discrepancy between Keras 2 and 3 #20507

matemijolovic opened this issue Nov 16, 2024 · 2 comments
Assignees

Comments

@matemijolovic
Copy link

matemijolovic commented Nov 16, 2024

Background

I was investigating why some of our relatively simple Keras models (mostly Efficientnet-like) fail to converge after being upgraded from Keras 2 to 3. Some minor tweaks made them converge (e.g. lowering the learning rate), but I was curious about finding the underlying issue since I found no relevant documentation or release notes that would explain the training discrepancy.

Minimal reproducible example

I set up two environments in Google Colab and tried to train exactly the same model with all the random generators seeded.
What I observed: I get training discrepancy when I add BatchNormalization layer.

Keras 2 / TF 2.14.1 notebook: https://colab.research.google.com/drive/1f7q-VcW7ugRPNxbCLkuE-q0O1WUJ8q-R?usp=sharing
Keras 3 / TF 2.17.0 notebook: https://colab.research.google.com/drive/1ONPJ_WXM6WQoJ8ze9bJJ9tjS94aNJ4KB?usp=sharing

Please let me know if I can do some additional experiments to track down the issue.

@matemijolovic
Copy link
Author

Sorry, I noticed a bug in my comparison - will reopen if I manage to fix it.

@matemijolovic
Copy link
Author

I managed to narrow down the initial question a bit, so reopening

@matemijolovic matemijolovic reopened this Nov 16, 2024
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

No branches or pull requests

2 participants