-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[air] add tuner user guide #26837
[air] add tuner user guide #26837
Conversation
Signed-off-by: Xiaowei Jiang <xwjiang2010@gmail.com>
Signed-off-by: Xiaowei Jiang <xwjiang2010@gmail.com>
Signed-off-by: Xiaowei Jiang <xwjiang2010@gmail.com>
Signed-off-by: Xiaowei Jiang <xwjiang2010@gmail.com>
doc/source/ray-air/tuner.rst
Outdated
|
||
Hyperparameter Tuning | ||
===================== | ||
Tuner API is the recommended way of launching hyperparameter tuning jobs with Ray Tune. |
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.
Add "what is a tuner and what does it do"?
# Conflicts: # doc/source/_toc.yml
Signed-off-by: Kai Fricke <kai@anyscale.com>
Signed-off-by: Kai Fricke <kai@anyscale.com>
Signed-off-by: Kai Fricke <kai@anyscale.com>
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.
LGTM let's follow up with the restore docs soon.
Also cc @richardliaw for review
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.
looking good; just a couple comments.
doc/source/ray-air/doc_code/tuner.py
Outdated
|
||
# Create Tuner | ||
tuner = tune.Tuner( | ||
my_trainer, |
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.
how about lets use a real trainer?
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.
It's covered in the following torch/xgboost sessions.
doc/source/ray-air/tuner.rst
Outdated
``num_samples=2`` here will be applied to the whole suite of grid search. In other words, | ||
we will generate 4 trials. | ||
|
||
For a more end-to-end example, checkout our :doc:`/ray-air/examples/analyze_tuning_results` guide. |
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.
This guide only for analysis right?
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.
We probably want to link out to Ray Tune user guide instead?
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.
No, it is actually an end to end example of Tuner. The title is a bit misleading.
Signed-off-by: xwjiang2010 <xwjiang2010@gmail.com>
doc/source/ray-air/tuner.rst
Outdated
There are a couple gotchas about parameter specification when using Tuners with Trainers: | ||
|
||
- By default, configuration dictionaries and config objects will be deep-merged | ||
- Parameters that are duplicated in the Trainer and Tuner will be overwritten by the Tuner ``param_space`` |
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.
param-space
.
doc/source/ray-air/tuner.rst
Outdated
- **Exception:** all arguments of the :class:`RunConfig <ray.air.config.RunConfig>` and :class:`TuneConfig <ray.tune.tune_config.TuneConfig>` are inherently un-tunable. | ||
|
||
|
||
How to configure a Tuner |
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.
How to configure a Tuner?
doc/source/ray-air/tuner.rst
Outdated
- custom callbacks | ||
- integration with cloud storage | ||
|
||
The following we showcase some common configuration of :class:`RunConfig <ray.air.config.RunConfig>`. |
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.
In the following section, we cover and showcase some common ...
doc/source/ray-air/tuner.rst
Outdated
:end-before: __basic_end__ | ||
|
||
|
||
How do I configure a search space? |
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.
How to configure a search space?
I would leave out first person I here.
doc/source/ray-air/tuner.rst
Outdated
See the :class:`RunConfig API reference <ray.air.config.RunConfig>` for more details. | ||
|
||
|
||
How do I specify parallelism? |
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.
How to configure parallelism?
doc/source/ray-air/tuner.rst
Outdated
Read more about this in :ref:`tune-parallelism` section. | ||
|
||
|
||
How do I specify an optimization algorithm? |
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.
How to specify an optimization algorithm?
doc/source/ray-air/tuner.rst
Outdated
How to analyze results? | ||
----------------------- | ||
|
||
``Tuner.fit()`` generates a ResultGrid object. This object contains metrics, results, and checkpoints |
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.
ResultGrid
doc/source/ray-air/tuner.rst
Outdated
----------------------- | ||
|
||
``Tuner.fit()`` generates a ResultGrid object. This object contains metrics, results, and checkpoints | ||
of each trial. Below is a simple usage example: |
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.
Below is a simple example:
doc/source/ray-air/tuner.rst
Outdated
Advanced Tuning | ||
--------------- | ||
|
||
Tuners also offer the possibility to apply different data preprocessing steps, as shown in the following snippet. |
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.
should this be the "capability" instead of "possibility"?
doc/source/ray-air/tuner.rst
Outdated
:start-after: __tune_preprocess_start__ | ||
:end-before: __tune_preprocess_end__ | ||
|
||
You can also sample different train/validation datasets: |
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.
Additionally, you sample different ...
doc/source/ray-air/tuner.rst
Outdated
Additionally, if trials fail during a tuning run, they can be retried - either from scratch or | ||
from the latest available checkpoint. | ||
|
||
To restore the Tuner state, you just pass the path to the experiment directory to ``Tuner.restore()``. |
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.
To restore the Tuner state, pass the path to the experiment directory as an argument to Tuner.restore(...)
doc/source/ray-air/tuner.rst
Outdated
|
||
To restore the Tuner state, you just pass the path to the experiment directory to ``Tuner.restore()``. | ||
|
||
This path can be obtained e.g. from the output of a tuning run (it's called "Result logdir"). If you |
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.
This path is obtained from the output of a tuning run, namely "Result logdir." However, if you specify a name
in the :class:RunConfig <ray.air.config.RunConfig>
, then it is located under ~/ray_results/<name>
.
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.
I'm bit confused about the diagram. Why it has Two boxes named "Trainer." We may want to clarify that in the caption.
@dmatrix addressed comments! |
Signed-off-by: Richard Liaw <rliaw@berkeley.edu>
Co-authored-by: Kai Fricke <kai@anyscale.com> Co-authored-by: Richard Liaw <rliaw@berkeley.edu>
Co-authored-by: Kai Fricke <kai@anyscale.com> Co-authored-by: Richard Liaw <rliaw@berkeley.edu> Signed-off-by: Stefan van der Kleij <s.vanderkleij@viroteq.com>
Why are these changes needed?
User guide for Tuner on the Ray AIR docs.
Related issue number
Checks
scripts/format.sh
to lint the changes in this PR.