ndarray-safetensors
Serialize / deserialize Rust ndarray with Safetensors.
Demo
See safetensors-testapp for more details. Here is an end-to-end demo to print all tensors from a safetensors file.
use parse_tensor_view_data;
let path_example = new;
let file = open.unwrap;
let buffer = unsafe ;
let tensors = deserialize.unwrap;
for in tensors.tensors
Features
The following crate feature flags are available. They are configured in your Cargo.toml.
unsafe_copy: Allowing directly copying the bytes instead of parsing floats in serialization/deserialization for little-endian machines.x86_sse: Using SSE instructions to optimize some conversions, it could be useful forfp16.
Copyright & License
Copyright (c) 2024-2025 Mengxiao Lin. Check LICENSE file.