RayTrainReportCallback#
- class ray.train.lightning.RayTrainReportCallback(*args: Any, **kwargs: Any)[source]#
Bases:
CallbackA simple callback that reports checkpoints to Ray on train epoch end.
This callback is a subclass of lightning.pytorch.callbacks.Callback.
It fetches the latest
trainer.callback_metricsand reports together with the checkpoint on each training epoch end.Checkpoints will be saved in the following structure:
checkpoint_00000*/ Ray Train Checkpoint └─ checkpoint.ckpt PyTorch Lightning Checkpoint
For customized reporting and checkpointing logic, implement your own
lightning.pytorch.callbacks.Callbackfollowing this user guide: Saving and Loading Checkpoints.- Parameters:
checkpoint_upload_mode (CheckpointUploadMode | None) – The manner in which to upload the checkpoint. See Checkpoint upload modes for more details. Ray Train v2 only. Defaults to
CheckpointUploadMode.SYNC.validation (bool | ValidationTaskConfig) – Whether to asynchronously validate the checkpoint, or a
ValidationTaskConfigfor the validation task. See Validating checkpoints asynchronously for more details. Ray Train v2 only.checkpoint_frequency (int) – Only report a checkpoint and metrics every
checkpoint_frequencyepochs. Defaults to1, which reports on every epoch. Ifmax_epochsisn’t a multiple ofcheckpoint_frequency, the epochs after the last multiple aren’t reported.
- Raises:
TypeError – If
checkpoint_frequencyisn’t an integer.ValueError – If
checkpoint_frequencyis less than 1, or ifcheckpoint_upload_modeorvalidationis set on Ray Train v1.
PublicAPI (beta): This API is in beta and may change before becoming stable.
Methods
Report metrics and a checkpoint to Ray Train at the end of an epoch.
Attributes