oneflow.load

oneflow.load(path: Union[os.PathLike, BinaryIO, IO[bytes], pathlib.Path, str], global_src_rank: Optional[int] = None, map_location: Optional[Union[Callable[[oneflow.Tensor, str], oneflow.Tensor], oneflow._oneflow_internal.device, str, oneflow._oneflow_internal.placement]] = None, *, support_pytorch_format: bool = True)Any

Loads an object saved with oneflow.save() from a directory.

Parameters
  • path – a file-like object (has to implement read(), readline(), tell(), and seek()), or a string or os.PathLike object containing a file name

  • global_src_rank (int, optional) – The source rank for loading global tensors. When specified, only the process whose rank == global_src_rank will really read the files in path, and tensors in the loaded object will be consistent with placement = flow.placement(‘cuda’, [global_src_rank])

  • map_location (str, flow.device or flow.placement, callable, optional) – indicates the location where all tensors should be loaded.

  • support_pytorch_format (bool, optional) – whether to support loading the file saved by torch.save. Default: True

Returns

The loaded object