Skip to content

lit_sb3.callbacks.checkpoint

source module lit_sb3.callbacks.checkpoint

Classes

source class CheckpointCallback(save_freq: int, save_path: str | Path, name_prefix: str = 'rl_model', save_replay_buffer: bool = False, save_vecnormalize: bool = False, verbose: int = 0)

Bases : BaseCallback

Callback for saving a model every save_freq calls.

to env.step(). By default, it only saves model checkpoints, you need to pass save_replay_buffer=True, and save_vecnormalize=True to also save replay buffer checkpoints and normalization statistics checkpoints.

.. warning::

When using multiple environments, each call to env.step() will effectively correspond to n_envs steps. To account for that, you can use save_freq = max(save_freq // n_envs, 1)

Parameters

  • save_freq : int — Save checkpoints every save_freq call of the callback.

  • save_path : str | Path — Path to the folder where the model will be saved.

  • name_prefix : str — Common prefix to the saved models

  • save_replay_buffer : bool — Save the model replay buffer

  • save_vecnormalize : bool — Save the VecNormalize statistics

  • verbose : int — Verbosity level: 0 for no output, 2 for indicating when saving model checkpoint

Attributes

  • state_key : str — Identifier for the state of the callback.