# tensorplay.serialization.load

Source: https://www.tensorplay.cn/docs/generated/tensorplay.serialization.load.html

# tensorplay.serialization.load

tensorplay.serialization.load(f: [str](https://docs.python.org/3/library/stdtypes.html#str) | [PathLike](https://docs.python.org/3/library/os.html#os.PathLike)[[str](https://docs.python.org/3/library/stdtypes.html#str)], map_location: [Any](https://docs.python.org/3/library/typing.html#typing.Any) | [None](https://docs.python.org/3/library/constants.html#None) = None, *, mmap: [bool](https://docs.python.org/3/library/functions.html#bool) = False, weights_only: [bool](https://docs.python.org/3/library/functions.html#bool) = True) &#x2192; [Any](https://docs.python.org/3/library/typing.html#typing.Any)[[source]](../_modules/tensorplay/serialization.html#load)

Load a checkpoint saved by tp.save or torch.save.

Format is detected by extension or content sniffing: .mega (and MEGA
shard indexes), .safetensors, and torch archives (.pt/.pth –
zip, magic-number stream, and tar layouts).

Parameters:

- f – path or file-like object (seekable binary).

- map_location – controls where tensors land. Accepts a device string / [tensorplay.Device](tensorplay.Device.html#tensorplay.Device) (all tensors), a mapping of saved location -> target, or a callable invoked per storage as fn(storage_stub, location) returning None , a device, or a TensorPlay tensor receiving the data.

- mmap – if true, MEGA and safetensors tensors are zero-copy views over a private (copy-on-write) mapping of the file; the returned containers keep the mapping alive, and bytes are paged in on first touch. Explicit device remapping still copies. Torch archives load eagerly.

- weights_only – accepted for API familiarity; every TensorPlay loader is weights-only by construction. Passing False warns.
