ray.train.torch.TorchCheckpoint
ray.train.torch.TorchCheckpoint#
- class ray.train.torch.TorchCheckpoint(local_path: Optional[Union[str, os.PathLike]] = None, data_dict: Optional[dict] = None, uri: Optional[str] = None)[source]#
Bases:
ray.air.checkpoint.CheckpointA
Checkpointwith Torch-specific functionality.Create this from a generic
Checkpointby callingTorchCheckpoint.from_checkpoint(ckpt).PublicAPI (beta): This API is in beta and may change before becoming stable.
Methods
__init__([local_path, data_dict, uri])DeveloperAPI: This API may change across minor Ray releases.
Return checkpoint directory path in a context.
from_bytes(data)Create a checkpoint from the given byte string.
from_checkpoint(other)Create a checkpoint from a generic
ray.air.checkpoint.Checkpoint.from_dict(data)Create checkpoint object from dictionary.
from_directory(path)Create checkpoint object from directory.
from_model(model, *[, preprocessor])Create a
Checkpointthat stores a Torch model.from_state_dict(state_dict, *[, preprocessor])Create a
Checkpointthat stores a model state dictionary.from_uri(uri)Create checkpoint object from location URI (e.g.
Return tuple of (type, data) for the internal representation.
get_model([model])Retrieve the model stored in this checkpoint.
Return the saved preprocessor, if one exists.
set_preprocessor(preprocessor)Saves the provided preprocessor to this Checkpoint.
to_bytes()Return Checkpoint serialized as bytes object.
to_dict()Return checkpoint data as dictionary.
to_directory([path])Write checkpoint data to directory.
to_uri(uri)Write checkpoint data to location URI (e.g.
Attributes
Return path to checkpoint, if available.
Return checkpoint URI, if available.