Skip to content

TorchPayloadCheckpointFile ​

python
TorchPayloadCheckpointFile(name: str, compress: bool = True) -> None

Base for checkpoint files that persist a single torch.save payload, optionally zstd-compressed.

Owns the extension/filename compression switch, the compressed/uncompressed save fork and the extension-sniffing load. Subclasses provide the payload via _payload and reconstruct themselves from the loaded data in their own _load, using _load_payload.

Initialize the checkpoint file.

Parameters:

  • name (str) – The checkpoint file's base name.
  • compress (bool) – Whether to zstd-compress the file.

Source

Properties ​

filename ​

python
filename: str

Source

Methods ​

extension ​

python
extension() -> str

Get the default file extension for this checkpoint type.

Returns:

  • str – The file extension.

Source

extensions ​

python
extensions() -> tuple[str, ...]

Get the compressed and uncompressed extensions this checkpoint type saves with.

Returns:

  • tuple[str, ...] – The extensions, compressed default first.

Source