to_directory#

Checkpoint.to_directory(path: str | PathLike | None = None) → str[source]#

Write checkpoint data to a local directory.

If multiple workers on the same node call this method simultaneously, only a single one will perform the download, while the others wait for the download to finish. Once the download finishes, all workers receive the same local directory to read from.

If no path is given, the checkpoint is downloaded to a temporary directory that is shared with every to_directory() and as_directory() call for this checkpoint on the node, so the checkpoint is downloaded only once. If it’s already downloaded, the path is returned immediately. Once this method returns the temporary directory, Ray never deletes it, so treat it as read-only.

Parameters:

path (str | PathLike | None) – Target directory to download data to. If not specified, this method will use a temporary directory.

Returns:

Directory containing checkpoint data.

Return type:

str