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

Fixed bug in ModelWeightAveraging class that led to corrupted model when metric to watch was NaN/Inf #1598

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

BloodAxe
Copy link
Collaborator

@BloodAxe BloodAxe commented Nov 1, 2023

A class was not checking whether observed metric is a finite number and included a state dict of the model that had inf/nan metric value into averaging.

The fix was three-liner:

val = float(validation_results_dict[self.metric_to_watch])

if not np.isfinite(val):
  return False, None

Copy link
Contributor

@Louis-Dupont Louis-Dupont left a comment

Choose a reason for hiding this comment

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

LGTM, just make sure the greater_is_better without default is fine for classification (as raised by ofri)

@BloodAxe BloodAxe merged commit c2821bb into master Nov 1, 2023
6 of 7 checks passed
@BloodAxe BloodAxe deleted the feature/SG-1158-fix-model-averaging branch November 1, 2023 11:48
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.

None yet

2 participants