mirror of
https://github.com/wassname/ray.git
synced 2026-08-05 13:21:03 +08:00
[tune] tune.track -> tune.report (#8388)
This commit is contained in:
@@ -31,7 +31,7 @@ Here's an example of specifying the objective function using :ref:`the function-
|
||||
for x in range(20):
|
||||
score = objective(x, config["a"], config["b"])
|
||||
|
||||
tune.track.log(score=score) # This sends the score to Tune.
|
||||
tune.report(score=score) # This sends the score to Tune.
|
||||
|
||||
Now, there's two Trainable APIs - one being the :ref:`function-based API <tune-function-api>` that we demonstrated above.
|
||||
|
||||
@@ -53,7 +53,7 @@ The other is a :ref:`class-based API <tune-class-api>` that enables :ref:`checkp
|
||||
self.x += 1
|
||||
return {"score": score}
|
||||
|
||||
.. tip:: Do not use ``tune.track.log`` within a ``Trainable`` class.
|
||||
.. tip:: Do not use ``tune.report`` within a ``Trainable`` class.
|
||||
|
||||
See the documentation: :ref:`trainable-docs` and :ref:`examples <tune-general-examples>`.
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ You can log arbitrary values and metrics in both training APIs:
|
||||
accuracy = model.train()
|
||||
metric_1 = f(model)
|
||||
metric_2 = model.get_loss()
|
||||
tune.track.log(acc=accuracy, metric_foo=random_metric_1, bar=metric_2)
|
||||
tune.report(acc=accuracy, metric_foo=random_metric_1, bar=metric_2)
|
||||
|
||||
class Trainable(tune.Trainable):
|
||||
...
|
||||
@@ -126,7 +126,7 @@ You can log arbitrary values and metrics in both training APIs:
|
||||
accuracy = self.model.train()
|
||||
metric_1 = f(self.model)
|
||||
metric_2 = self.model.get_loss()
|
||||
# don't call track.log here!
|
||||
# don't call report here!
|
||||
return dict(acc=accuracy, metric_foo=random_metric_1, bar=metric_2)
|
||||
|
||||
During training, Tune will automatically log the below metrics in addition to the user-provided values. All of these can be used as stopping conditions or passed as a parameter to Trial Schedulers/Search Algorithms.
|
||||
@@ -230,7 +230,7 @@ Stopping Trials
|
||||
|
||||
You can control when trials are stopped early by passing the ``stop`` argument to ``tune.run``. This argument takes either a dictionary or a function.
|
||||
|
||||
If a dictionary is passed in, the keys may be any field in the return result of ``tune.track.log`` in the Function API or ``_train()`` (including the results from ``_train`` and auto-filled metrics).
|
||||
If a dictionary is passed in, the keys may be any field in the return result of ``tune.report`` in the Function API or ``_train()`` (including the results from ``_train`` and auto-filled metrics).
|
||||
|
||||
In the example below, each trial will be stopped either when it completes 10 iterations OR when it reaches a mean accuracy of 0.98. These metrics are assumed to be **increasing**.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user