Expand description
Reading and writing arrays: safetensors (MLX’s checkpoint format) and NumPy’s .npy,
loaded without a copy by memory-mapping the file, and the IDX format (MNIST); a
minimal json parser for model files.
Status: pre-alpha.
Modules§
- json
- A minimal JSON parser (RFC 8259) for safetensors headers and model files (configs, tokenizers), so that no serialization framework is needed.
Structs§
- Safe
Tensors - The tensors and metadata of a safetensors file.
Constants§
- VERSION
- The version of this crate.
Functions§
- load_
npy - Loads a
.npyfile as a view of the memory-mapped file. - load_
safetensors - Loads a safetensors file. The tensors are views of the memory-mapped file (or of one copy of its data, if they are not aligned to their element sizes).
- parse_
idx - Parses an IDX file’s bytes. Element types map to
uint8,int8,int16,int32,float32andfloat64. - read_
idx - Reads an (uncompressed) IDX file.
- save_
npy - Saves
a(evaluating it) as a C-order.npyfile (version 1). bfloat16 has no NumPy type and is rejected. - save_
safetensors - Saves
tensors(evaluating them) andmetadataas a safetensors file.