Shortcuts

CheckpointIO

class lightning.pytorch.plugins.io.CheckpointIO[소스]

기반 클래스: abc.ABC

Interface to save/load checkpoints as they are saved through the Strategy.

경고

This is an experimental feature.

Typically most plugins either use the Torch based IO Plugin; TorchCheckpointIO but may require particular handling depending on the plugin.

In addition, you can pass a custom CheckpointIO by extending this class and passing it to the Trainer, i.e Trainer(plugins=[MyCustomCheckpointIO()]).

참고

For some plugins, it is not possible to use a custom checkpoint plugin as checkpointing logic is not modifiable.

abstract load_checkpoint(path, map_location=None)[소스]

Load checkpoint from a path when resuming or loading ckpt for test/validate/predict stages.

매개변수

Returns: The loaded checkpoint.

반환 형식

Dict[str, Any]

abstract remove_checkpoint(path)[소스]

Remove checkpoint file from the filesystem.

매개변수

path (Union[str, Path]) – Path to checkpoint

반환 형식

None

abstract save_checkpoint(checkpoint, path, storage_options=None)[소스]

Save model/training states as a checkpoint file through state-dump and file-write.

매개변수
  • checkpoint (Dict[str, Any]) – dict containing model and trainer state

  • path (Union[str, Path]) – write-target path

  • storage_options (Optional[Any]) – Optional parameters when saving the model/training states.

반환 형식

None

teardown()[소스]

This method is called to teardown the process.

반환 형식

None