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] Make `Tuner.restore(trainable=...) a required argument #34982

Merged
merged 21 commits into from
May 4, 2023

Conversation

justinvyu
Copy link
Contributor

Why are these changes needed?

Hard deprecation: This PR makes Tuner.restore(..., trainable) a required argument. This removes the special case of tune.with_parameters throwing a very complicated error message if you try to restore without re-specifying the trainable. Users will have access to the trainable on restore anyways, and the restore API now mirrors the regular Tuner constructor, where trainable is required and param_space is optional.

This PR also simplifies validation logic on restore -- and also adding loose validation that the param_space has at least the same keys as before (preventing users from trying to add new hyperparameters after restoration).

Context

See here for context: #32912, #32912 (comment)

Related issue number

Closes #33546

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • 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 added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • 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.

Code LGTM, only 2 minor questions. One of the new tests seems to be failing

python/ray/tune/impl/tuner_internal.py Outdated Show resolved Hide resolved
python/ray/tune/impl/tuner_internal.py Outdated Show resolved Hide resolved
@justinvyu justinvyu added the tests-ok The tagger certifies test failures are unrelated and assumes personal liability. label May 4, 2023
@justinvyu justinvyu requested a review from krfricke May 4, 2023 21:05
@justinvyu
Copy link
Contributor Author

Tests look ok - apart from the GPU early kickoff weirdness.

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!

@krfricke krfricke merged commit a2946eb into ray-project:master May 4, 2023
@justinvyu justinvyu deleted the restore/required_trainable branch May 4, 2023 21:51
architkulkarni pushed a commit to architkulkarni/ray that referenced this pull request May 16, 2023
…oject#34982)

**Hard deprecation**: This PR makes `Tuner.restore(..., trainable)` a required argument. This removes the special case of `tune.with_parameters` throwing a very complicated error message if you try to restore without re-specifying the trainable. Users will have access to the `trainable` on restore anyways, and the restore API now mirrors the regular `Tuner` constructor, where `trainable` is required and `param_space` is optional.

This PR also simplifies validation logic on restore -- and also adding loose validation that the `param_space` has at least the same keys as before (preventing users from trying to add new hyperparameters after restoration).

Signed-off-by: Justin Yu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests-ok The tagger certifies test failures are unrelated and assumes personal liability.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Tune] Simplify trainable validation logic on Tuner.restore(path, trainable=...) for Ray 2.5
2 participants