llama-rs 0.17.0

A high-performance Rust implementation of llama.cpp - LLM inference engine with full GGUF support
Documentation
//! SafeTensors file format support
//!
//! Parses HuggingFace SafeTensors files for model weight loading.
//! Supports both single-file and sharded (multi-file) models.

mod reader;
mod names;
mod loader;

pub use reader::{SafeTensorsFile, SafeTensorInfo, SafeTensorsDtype, ShardedSafeTensors};
pub use names::TensorNameMapper;
pub use loader::SafeTensorsLoader;

use thiserror::Error;

#[derive(Error, Debug)]
pub enum SafeTensorsError {
    #[error("IO error: {0}")]
    Io(#[from] std::io::Error),

    #[error("JSON parse error: {0}")]
    Json(#[from] serde_json::Error),

    #[error("Invalid SafeTensors file: {0}")]
    InvalidFormat(String),

    #[error("Tensor not found: {0}")]
    TensorNotFound(String),

    #[error("Unsupported dtype: {0}")]
    UnsupportedDtype(String),
}

pub type SafeTensorsResult<T> = Result<T, SafeTensorsError>;