ray.train.Checkpoint#
- class ray.train.Checkpoint(path: str | PathLike, filesystem: pyarrow.fs.FileSystem | None = None)#
A reference to data persisted as a directory in local or remote storage.
Access the checkpoint contents locally using
checkpoint.to_directory()
orcheckpoint.as_directory
.Example creating a checkpoint using
Checkpoint.from_directory
:>>> from ray.train import Checkpoint >>> checkpoint = Checkpoint.from_directory("/tmp/example_checkpoint_dir") >>> checkpoint.filesystem <pyarrow._fs.LocalFileSystem object... >>> checkpoint.path '/tmp/example_checkpoint_dir'
Example creating a checkpoint from a remote URI:
>>> checkpoint = Checkpoint("s3://bucket/path/to/checkpoint") >>> checkpoint.filesystem <pyarrow._s3fs.S3FileSystem object... >>> checkpoint.path 'bucket/path/to/checkpoint'
Example creating a checkpoint with a custom filesystem:
>>> checkpoint = Checkpoint( ... path="bucket/path/to/checkpoint", ... filesystem=pyarrow.fs.S3FileSystem(), ... ) >>> checkpoint.filesystem <pyarrow._s3fs.S3FileSystem object... >>> checkpoint.path 'bucket/path/to/checkpoint'
- path#
A path on the filesystem containing the checkpoint contents.
PublicAPI (beta): This API is in beta and may change before becoming stable.
Methods
Construct a Checkpoint.
Returns checkpoint contents in a local directory as a context.
Create checkpoint object from a local directory.
Return the metadata dict stored with the checkpoint.
Set the metadata stored with this checkpoint.
Write checkpoint data to a local directory.
Update the metadata stored with this checkpoint.