ray.train.trainer.BaseTrainer.training_loop#

abstract BaseTrainer.training_loop() None[source]#

Loop called by fit() to run training and report results to Tune.

Note

This method runs on a remote process.

self.datasets have already been evaluated if they were wrapped in a factory.

You can use the Ray Train utilities (train.report() and train.get_checkpoint()) inside this training loop.

Example:

from ray.train.trainer import BaseTrainer
from ray import train

class MyTrainer(BaseTrainer):
    def training_loop(self):
        for epoch_idx in range(5):
            ...
            train.report({"epoch": epoch_idx})