-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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] OptunaSearch: check compatibility of search space with evaluated_rewards #18625
[tune] OptunaSearch: check compatibility of search space with evaluated_rewards #18625
Conversation
@ccssmnn Lint is still failing with As for running tests locally, you should create a new virutalenv, follow instructions on how to setup ray python dev environment and then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a lot of unrelated code being reformatted. Can you ensure that you are using the right yapf version for scripts/format.sh
, and that only related code is commited? Thanks!
python/ray/tune/suggest/optuna.py
Outdated
@@ -54,7 +54,6 @@ class _OptunaTrialSuggestCaptor: | |||
`suggest_` callables with a function capturing the returned value, | |||
which will be saved in the ``captured_values`` dict. | |||
""" | |||
|
|||
def __init__(self, ot_trial: OptunaTrial) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leave an empty line here?
python/ray/tune/suggest/optuna.py
Outdated
@@ -126,6 +125,12 @@ class OptunaSearch(Searcher): | |||
needing to re-compute the trial. Must be the same length as | |||
points_to_evaluate. | |||
|
|||
..warning:: | |||
When using evaluated_rewards, the search space `space` must |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using evaluated_rewards, the search space `space` must | |
When using ``evaluated_rewards``, the search space ``space`` must |
python/ray/tune/suggest/optuna.py
Outdated
``optuna.distributions``. The define-by-run definition is not | ||
yet supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``optuna.distributions``. The define-by-run definition is not | |
yet supported. | |
``optuna.distributions`` instances as values. The define-by-run | |
search space definition is not yet supported with this functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks! Just one last nit. Feel free to mark it as ready for review.
Co-authored-by: Antoni Baum <[email protected]>
Thanks @Yard1 ! I'm still running into errors executing the test locally though. My steps:
Results in the following error:
This may be irrelevant for this PR, but it can be a blocker for future PRs. |
@ccssmnn Hey, sorry to keep you waiting. The workflow you have posted is pretty much exactly what I am doing. Not sure why it would cause such an error for you. Can you try again? I will merge master into your branch to make CI pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Why are these changes needed?
OptunaSearch accepts both distribution dictionary or define-by-run as a definition for the search space. The latter should not be used, when
evaluated_rewards
is provided. Creation of trials in Optuna only allows the distribution strategy.This PR adds docs for this case and provides a meaningful error when define-by-run is used with evaluated_rewards
Related issue number
Closes #18587
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
I need some guidance how to run the tests. Is there guidance on how to execute the tests? Installing the dependencies inside the python folder and running
python -m unittest
fails to execute the tests:ImportError: Failed to import test module: ray
.