Mojo function
load
load[PathLike: PathLike](path: PathLike) -> TensorDict
Reads tensors from saved checkpoint file.
This supports only MAX checkpoint files saved with
save()
.
For example:
from max.graph.checkpoint import load, TensorDict
from max.tensor import Tensor, TensorShape
def read_from_disk():
tensors = load("/path/to/checkpoint.maxckpt")
x = tensors.get("x").to_tensor[DType.int32]()
from max.graph.checkpoint import load, TensorDict
from max.tensor import Tensor, TensorShape
def read_from_disk():
tensors = load("/path/to/checkpoint.maxckpt")
x = tensors.get("x").to_tensor[DType.int32]()
Args:
- path (
PathLike
): Path to existing checkpoint file.
Returns:
TensorDict containing loaded Tensors.
Raises:
If the checkpoint file was saved with an older serialization format.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!