prepare_trainer#

ray.train.lightning.prepare_trainer(trainer: pytorch_lightning.Trainer) → pytorch_lightning.Trainer[source]#

Prepare the PyTorch Lightning Trainer for distributed execution.

Checks that the trainer’s strategy is a RayDDPStrategy, RayFSDPStrategy, or RayDeepSpeedStrategy, or a subclass of one, and that its cluster environment, if it has one, is a RayLightningEnvironment.

Parameters:

trainer (pytorch_lightning.Trainer) – The Lightning Trainer to prepare.

Returns:

The same trainer object.

Raises:

RuntimeError – If the trainer’s strategy or cluster environment isn’t one of the classes above.

Return type:

pytorch_lightning.Trainer

PublicAPI (beta): This API is in beta and may change before becoming stable.