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, orRayDeepSpeedStrategy, or a subclass of one, and that its cluster environment, if it has one, is aRayLightningEnvironment.- Parameters:
trainer (pytorch_lightning.Trainer) – The Lightning
Trainerto prepare.- Returns:
The same
trainerobject.- 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.