- class ray.air.CheckpointConfig(num_to_keep: Optional[int] = None, checkpoint_score_attribute: Optional[str] = None, checkpoint_score_order: str = 'max', checkpoint_frequency: int = 0, checkpoint_at_end: Optional[bool] = None)[source]#
Configurable parameters for defining the checkpointing strategy.
Default behavior is to persist all checkpoints to disk. If
num_to_keepis set, the default retention policy is to keep the checkpoints with maximum timestamp, i.e. the most recent checkpoints.
num_to_keep – The number of checkpoints to keep on disk for this run. If a checkpoint is persisted to disk after there are already this many checkpoints, then an existing checkpoint will be deleted. If this is
Nonethen checkpoints will not be deleted. Must be >= 1.
checkpoint_score_attribute – The attribute that will be used to score checkpoints to determine which checkpoints should be kept on disk when there are greater than
num_to_keepcheckpoints. This attribute must be a key from the checkpoint dictionary which has a numerical value. Per default, the last checkpoints will be kept.
checkpoint_score_order – Either “max” or “min”. If “max”, then checkpoints with highest values of
checkpoint_score_attributewill be kept. If “min”, then checkpoints with lowest values of
checkpoint_score_attributewill be kept.
checkpoint_frequency – Number of iterations between checkpoints. If 0 this will disable checkpointing. Please note that most trainers will still save one checkpoint at the end of training. This attribute is only supported by trainers that don’t take in custom training loops.
checkpoint_at_end – If True, will save a checkpoint at the end of training. This attribute is only supported by trainers that don’t take in custom training loops. Defaults to True for trainers that support it and False for generic function trainables.
PublicAPI (beta): This API is in beta and may change before becoming stable.