mlx.core.load#
- load(file: file | str | Path, /, format: str | None = None, return_metadata: bool = False, *, stream: None | Stream | Device = None) array | dict[str, array]#
- Load array(s) from a binary file. - The supported formats are - .npy,- .npz,- .safetensors, and- .gguf.- Parameters:
- format (str, optional) – Format of the file. If - None, the format is inferred from the file extension. Supported formats:- npy,- npz, and- safetensors. Default:- None.
- return_metadata (bool, optional) – Load the metadata for formats which support matadata. The metadata will be returned as an additional dictionary. Default: - False.
 
- Returns:
- A single array if loading from a - .npyfile or a dict mapping names to arrays if loading from a- .npzor- .safetensorsfile. If- return_metadatais- Truean additional dictionary of metadata will be returned.
- Return type:
 - Warning - When loading unsupported quantization formats from GGUF, tensors will automatically cast to - mx.float16
