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] deflake pbt. #21366

Merged
merged 5 commits into from
Jan 4, 2022
Merged

[tune] deflake pbt. #21366

merged 5 commits into from
Jan 4, 2022

Conversation

xwjiang2010
Copy link
Contributor

@xwjiang2010 xwjiang2010 commented Jan 4, 2022

Why are these changes needed?

We use trial.checkpoint to restore a perturbed trial. Currently trial.checkpoint is looking at both in-memory and persistent checkpoints to find the most recent one. The definition of "the most recent one" is based on iteration. This may no longer be a valid assumption in PBT case, considering trial_low_quantile may have an iter=2_persistent_checkpoint as well as a iter=1_in_memory_checkpoint (perturbed from trial_upper_quantile).

BTW, I think there are a few other issues to clean up for PBT case, depending on how important we think PBT is. For example,

  • multiple times of checkpoint for the same trial at the same stage (trial_upper.save(MEMORY), trial_upper.save(PERSISTENT), trial_upper.pause() (which includes a trial_upper.save(MEMORY)) )
  • the potential data inconsistency between PBT.trial_state and real trial state. Ideally PBT should not keep its copy of trial state.

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 :(

Copy link
Contributor

@krfricke krfricke left a comment

Choose a reason for hiding this comment

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

Great discovery, thanks!

Comment on lines 121 to 125
self._cur_order += 1
checkpoint.order = self._cur_order
self.on_checkpoint_internal(checkpoint)

def on_checkpoint_internal(self, checkpoint):
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the on_checkpoint_internal function here? Seems like we never call it anywhere else

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh right, making it private

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the purpose of splitting out on_checkpoint_internal into a separate method altogether?

What logic should be contained in the external method vs. the internal method?

Copy link
Contributor

@krfricke krfricke Jan 4, 2022

Choose a reason for hiding this comment

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

Yep, would also vote to remove the function completely and just keep on_checkpoint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure. combining the two.

@krfricke
Copy link
Contributor

krfricke commented Jan 4, 2022

To fix the build errors, merge current master

Copy link
Contributor

@krfricke krfricke left a comment

Choose a reason for hiding this comment

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

Awesome, merging after tests pass

@krfricke krfricke merged commit fc22200 into ray-project:master Jan 4, 2022
@xwjiang2010 xwjiang2010 deleted the fix_pbt branch July 26, 2023 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.

3 participants