# mlx.core.load — MLX 0.0.7 documentation

Skip to main content
`Ctrl`+`K`

# mlx.core.load

mlx.core.load(file: str, /, format: Optional[ str ] = None, *, stream: Union[ None , Stream , Device ] = None) → Union[ array , Dict[ str , array ]]

  Load array(s) from a binary file in `.npy`, `.npz`, or `.safetensors` format.

  Parameters:

    - file (file, str) – File in which the array is saved.

    - 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`.

  Returns:

    A single array if loading from a `.npy` file or a dict mapping names to arrays if loading from a `.npz` or `.safetensors` file.

  Return type:

    result (array, dict)