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: bug in variables ordering in NormalizedReluBounding #98

Merged
merged 6 commits into from
Jan 30, 2025

Conversation

lzampier
Copy link
Member

A bug affects anemoi.models.layers.bounding.NormalizedReluBounding if the order of the variable douring the call in config does not match the order of the variables in the torch array. This a problem emerged only when multiple variables were bounded at the same time with this procedure.

This is fixed by making sure that self.norm_min_val follows the same order as self.data_index.

@lzampier lzampier added bug Something isn't working models labels Jan 28, 2025
@lzampier lzampier requested a review from sahahner January 28, 2025 10:45
@lzampier lzampier self-assigned this Jan 28, 2025
@lzampier lzampier changed the title Bugfix for variable ordering in NormalizedReluBounding fix: bug in variables ordering in NormalizedReluBounding Jan 28, 2025
@lzampier lzampier requested a review from sahahner January 28, 2025 12:51
@JesperDramsch
Copy link
Member

Would it make sense to add a test that would catch this bug next time?

@lzampier
Copy link
Member Author

lzampier commented Jan 28, 2025

The effect of the bug does only show in the training metrics. I can write a test that fails if the order of variables is still wrong after the initialization.

@lzampier lzampier marked this pull request as draft January 28, 2025 14:50
@lzampier lzampier closed this Jan 29, 2025
@lzampier lzampier reopened this Jan 30, 2025
@lzampier
Copy link
Member Author

Would it make sense to add a test that would catch this bug next time?

Yes, more tests would be good. I would postpone this to a different pull request, given that we will refactor the interface of this function to make it simpler over the next days. The tests will also inevitably change for the refactor.

@lzampier lzampier marked this pull request as ready for review January 30, 2025 09:47
Copy link
Member

@sahahner sahahner left a comment

Choose a reason for hiding this comment

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

Looks good.

@lzampier lzampier merged commit f1cc2e6 into main Jan 30, 2025
18 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working models
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants