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

Fix broken test for models with batchnorm #17841

Merged
merged 3 commits into from
Jun 23, 2022

Conversation

Rocketknight1
Copy link
Member

One of the Keras tests assumed that fitting a model for one iteration with a learning rate of zero would not change any weights. This is not true for BatchNorm, which updates its running means and variances regardless! As a result, the model after the iteration had slightly different outputs, which caused the test to be very flaky. We now reinitialize the model after the single training epoch to make sure this doesn't happen.

@Rocketknight1
Copy link
Member Author

Related to #17427, cc @amyeroberts .

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 23, 2022

The documentation is not available anymore as the PR was closed or merged.

...give you the same weights each time.
I am good at machine learning.
@Rocketknight1 Rocketknight1 marked this pull request as ready for review June 23, 2022 14:02
Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for the fix! ❤️

@Rocketknight1 Rocketknight1 merged commit 1a7ef33 into main Jun 23, 2022
@Rocketknight1 Rocketknight1 deleted the fix_tf_tests_for_batchnorm branch June 23, 2022 14:59
@gante
Copy link
Member

gante commented Jun 23, 2022

🧠

@Rocketknight1
Copy link
Member Author

Give @amyeroberts the brain emoji for that one - she identified the whole problem, I just fixed the test!

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.

4 participants