Expand description
Axonml Serialize - Model Serialization for Axonml ML Framework
This crate provides functionality for saving and loading trained models, including state dictionaries, model checkpoints, and format conversion.
§Supported Formats
- Axonml Native (.axonml) - Efficient binary format
- JSON (.json) - Human-readable format for debugging
SafeTensors(.safetensors) - Safe, fast format (optional feature)
§Example
ⓘ
use axonml_serialize::{save_model, load_model, StateDict};
// Save model
save_model(&model, "model.axonml")?;
// Load model
let state_dict = load_state_dict("model.axonml")?;
model.load_state_dict(&state_dict)?;@version 0.1.0
@author AutomataNexus Development Team
Structs§
- Checkpoint
- A complete training checkpoint.
- Checkpoint
Builder - Builder for creating checkpoints.
- State
Dict - State dictionary for storing model parameters.
- State
Dict Entry - An entry in the state dictionary.
- Tensor
Data - Serializable tensor data.
- Training
State - Training state for checkpointing.
Enums§
- Format
- Supported serialization formats.
- Onnx
OpType - ONNX operator type mapping.
Functions§
- convert_
from_ pytorch - Convert a state dict from
PyTorchnaming conventions. - detect_
format - Detect the format from a file path based on extension.
- detect_
format_ from_ bytes - Detect format from file contents (magic bytes).
- from_
onnx_ shape - Convert from ONNX shape (handling -1 for dynamic dimensions).
- from_
pytorch_ key - Convert a PyTorch-style key to Axonml format.
- load_
checkpoint - Load a training checkpoint.
- load_
state_ dict - Load a state dictionary from a file.
- pytorch_
layer_ mapping - Map of
PyTorchlayer names to Axonml equivalents. - save_
checkpoint - Save a complete training checkpoint.
- save_
model - Save a model’s state dictionary to a file.
- save_
state_ dict - Save a state dictionary to a file with specified format.
- to_
onnx_ shape - Convert a shape to ONNX format (with batch dimension handling).
- to_
pytorch_ key - Convert a Axonml key to
PyTorchformat. - transpose_
linear_ weights - Transpose weights if needed for format conversion.