avalanche.checkpointing.save_checkpoint(strategy, fname: str | PathLike | BinaryIO | IO[bytes], exclude: Collection[str] | None = None)[source]

Save the strategy state into a file.

The file can be loaded using maybe_load_checkpoint.

For efficiency, the user can specify some attributes to exclude. For example, if the optimizer is static and doesn’t change during training, it can be safely excluded. These helps to speed up the serialization.

WARNING: the method cannot be used inside the training and evaluation loops of the strategy.

  • strategy – strategy to serialize.

  • fname – name of the file.

  • exclude – List[string] list of attributes to remove before the serialization.