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

[Tune] Don't include nan metrics for best checkpoint #23820

Merged
merged 2 commits into from
Apr 11, 2022

Conversation

amogkam
Copy link
Contributor

@amogkam amogkam commented Apr 10, 2022

Nan values do not have a well defined ordering. When sorting metrics to determine the best checkpoint, we should always filter out checkpoints that are associated with nan values.

Closes #23812

Why are these changes needed?

Related issue number

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Comment on lines +455 to +459
# Filter out nan. Sorting nan values leads to undefined behavior.
checkpoint_paths = [
(path, metric) for path, metric in checkpoint_paths if not is_nan(metric)
]

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should also check whether the filtered list is empty.

In addition, we can also have a fallback option when all metric values are nan. For example, if all are nan, return the latest checkpoint.

Copy link
Member

Choose a reason for hiding this comment

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

I think we could just move the filtering above the if not checkpoint_paths check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated!

@Yard1
Copy link
Member

Yard1 commented Apr 10, 2022

Can we add a sentence to the docstring that nan checkpoints will be filtered out? Thanks!

@amogkam amogkam requested a review from Yard1 April 11, 2022 17:23
@amogkam
Copy link
Contributor Author

amogkam commented Apr 11, 2022

Failing tests are unrelated, going to merge

@amogkam amogkam merged commit d33483d into ray-project:master Apr 11, 2022
@amogkam amogkam deleted the fix-best-checkpoint-nan branch April 11, 2022 19:51
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.

[Tune][Bug] tune.ExperimentAnalysis.best_checkpoint does not filter nan metric values
5 participants