abstract BaseTrainer.training_loop() None[source]#

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


This method runs on a remote process.

self.datasets have already been preprocessed by self.preprocessor.

You can use the Tune Function API functions (session.report() and session.get_checkpoint()) inside this training loop.


from ray.train.trainer import BaseTrainer

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