[tune] Fix up examples (#9201)

This commit is contained in:
Richard Liaw
2020-07-05 01:16:20 -07:00
committed by GitHub
parent f7ac495a68
commit b71c912da7
22 changed files with 380 additions and 243 deletions
-46
View File
@@ -126,52 +126,6 @@ Use ``self.logdir`` (only for Class API) or ``tune.track.logdir`` (only for Func
In the distributed case, these logs will be sync'ed back to the driver under your logger path. This will allow you to visualize and analyze logs of all distributed training workers on a single machine.
Log Directory
-------------
Tune will log the results of each trial to a subfolder under a specified local dir, which defaults to ``~/ray_results``.
.. code-block:: python
# This logs to 2 different trial folders:
# ~/ray_results/trainable_name/trial_name_1 and ~/ray_results/trainable_name/trial_name_2
# trainable_name and trial_name are autogenerated.
tune.run(trainable, num_samples=2)
You can specify the ``local_dir`` and ``trainable_name``:
.. code-block:: python
# This logs to 2 different trial folders:
# ./results/test_experiment/trial_name_1 and ./results/test_experiment/trial_name_2
# Only trial_name is autogenerated.
tune.run(trainable, num_samples=2, local_dir="./results", name="test_experiment")
To specify custom trial folder names, you can pass use the ``trial_name_creator`` argument
to `tune.run`. This takes a function with the following signature:
.. code-block:: python
def trial_name_string(trial):
"""
Args:
trial (Trial): A generated trial object.
Returns:
trial_name (str): String representation of Trial.
"""
return str(trial)
tune.run(
MyTrainableClass,
name="example-experiment",
num_samples=1,
trial_name_creator=trial_name_string
)
See the documentation on Trials: :ref:`trial-docstring`.
Viskit
------
+2 -2
View File
@@ -20,13 +20,13 @@ Tune includes distributed implementations of early stopping algorithms such as `
.. tip:: The easiest scheduler to start with is the ``ASHAScheduler`` which will aggressively terminate low-performing trials.
When using schedulers, you may face compatibility issues, as shown in the below compatibility matrix. Certain schedulers cannot be used with Search Algorithms, and certain schedulers are only compatible with the :ref:`tune-class-api`.
When using schedulers, you may face compatibility issues, as shown in the below compatibility matrix. Certain schedulers cannot be used with Search Algorithms, and certain schedulers are require :ref:`checkpointing to be implemented <tune-checkpoint>`.
.. list-table:: TrialScheduler Feature Compatibility Matrix
:header-rows: 1
* - Scheduler
- Class API Required?
- Need Checkpointing?
- SearchAlg Compatible?
- Example
* - :ref:`ASHA <tune-scheduler-hyperband>`
+1 -1
View File
@@ -256,7 +256,7 @@ The ``Trainable`` also provides the ``default_resource_requests`` interface to a
.. _track-docstring:
.. _tune-function-docstring:
tune.report / tune.checkpoint (Function API)
--------------------------------------------