Skip to main content

save

Function save 

Source
pub fn save<T: Leaves + ?Sized>(path: impl AsRef<Path>, tree: &T) -> Result<()>
Expand description

Writes the leaves of tree as a safetensors file, each named by its path (MLX’s tree_flatten names), evaluating them.

The file’s metadata records format = "nuvec-tree", the root type name and, when the tree holds 0-D leaves named step and learning_rate (an optimizer’s state), their values (informational: the tensors are authoritative). Checkpointing a training run is nuvec::save(path, &(model, opt))?, resuming it nuvec::load_into(path, &mut (model, opt))? (after opt.init(&model)).

Duplicate paths are an error.