← Back

Module formats

enum FormatError

Source: formats.joule:27

fn from(e: io::Error) -> Self

Source: formats.joule:40

struct TensorMeta

Source: formats.joule:47

fn numel(&self) -> usize

Number of elements

Source: formats.joule:58

fn unquantized_size(&self) -> u64

Size in bytes (unquantized)

Source: formats.joule:63

struct QuantizationMeta

Source: formats.joule:70

enum QuantType

Source: formats.joule:79

fn bits_per_weight(&self) -> f32

Bits per weight

Source: formats.joule:117

enum LoadStrategy

Source: formats.joule:139

struct LoadOptions

Source: formats.joule:152

fn default() -> Self

Source: formats.joule:168

const GGUF_MAGIC: u32

GGUF file header

Source: formats.joule:185

const GGUF_VERSION_2: u32

Source: formats.joule:186

const GGUF_VERSION_3: u32

Source: formats.joule:187

enum GgufValue

Source: formats.joule:191

fn as_u32(&self) -> Option<u32>

Source: formats.joule:208

fn as_u64(&self) -> Option<u64>

Source: formats.joule:217

fn as_f32(&self) -> Option<f32>

Source: formats.joule:226

fn as_str(&self) -> Option<&str>

Source: formats.joule:234

fn as_bool(&self) -> Option<bool>

Source: formats.joule:241

struct GgufTensorInfo

Source: formats.joule:251

enum GgufDType

Source: formats.joule:262

fn to_dtype(&self) -> DType

Convert to Joule DType

Source: formats.joule:295

fn block_size(&self) -> usize

Bytes per element (or per block for quantized)

Source: formats.joule:311

fn block_elements(&self) -> usize

Elements per block

Source: formats.joule:341

fn size_bytes(&self, n_elements: usize) -> usize

Size in bytes for given number of elements

Source: formats.joule:358

fn try_from(v: u32) -> Result<Self, Self::Error>

Source: formats.joule:368

struct GgufLoader

GGUF model loader

Source: formats.joule:404

struct MmapHandle

Memory-mapped file handle (platform specific)

Source: formats.joule:417

fn open(path: impl AsRef<Path>) -> Result<Self, FormatError>

Source: formats.joule:425

fn open_with_options(

Source: formats.joule:431

fn metadata(&self) -> &HashMap<String, GgufValue>

Get model metadata

Source: formats.joule:509

fn get_meta(&self, key: &str) -> Option<&GgufValue>

Get metadata value

Source: formats.joule:514

fn architecture(&self) -> Option<&str>

Get architecture name

Source: formats.joule:519

fn name(&self) -> Option<&str>

Get model name

Source: formats.joule:524

fn context_length(&self) -> Option<u32>

Get context length

Source: formats.joule:529

fn embedding_length(&self) -> Option<u32>

Get embedding length

Source: formats.joule:536

fn num_layers(&self) -> Option<u32>

Get number of layers

Source: formats.joule:543

fn num_heads(&self) -> Option<u32>

Get number of attention heads

Source: formats.joule:550

fn vocab_size(&self) -> Option<u32>

Get vocab size

Source: formats.joule:557

fn tensor_names(&self) -> Vec<&str>

Get list of tensor names

Source: formats.joule:569

fn tensor_info(&self, name: &str) -> Option<&GgufTensorInfo>

Get tensor info by name

Source: formats.joule:574

fn tensors(&self) -> impl Iterator<Item = TensorMeta> + '_

List all tensor metadata

Source: formats.joule:579

fn load_tensor(&self, name: &str) -> Result<Tensor, FormatError>

Source: formats.joule:597

fn load_tensor_to_device(

Source: formats.joule:624

fn load_all(&self) -> Result<HashMap<String, Tensor>, FormatError>

Source: formats.joule:637

fn stream_tensors<F>(&self, mut callback: F) -> Result<(), FormatError>

Source: formats.joule:650

fn total_parameters(&self) -> u64

Total parameter count

Source: formats.joule:664

fn total_size_bytes(&self) -> u64

Total size in bytes

Source: formats.joule:671

fn estimate_load_energy(&self) -> Joules

Estimate energy to fully load model

Source: formats.joule:679

fn energy_scope(&self, op: &str) -> Option<EnergyScope>

Source: formats.joule:687

fn read_metadata_kv(file: &mut File, version: u32) -> Result<(String, GgufValue), FormatError>

Source: formats.joule:691

fn read_string(file: &mut File, version: u32) -> Result<String, FormatError>

Source: formats.joule:697

fn read_value(file: &mut File, version: u32) -> Result<GgufValue, FormatError>

Source: formats.joule:705

fn read_tensor_info(file: &mut File, version: u32) -> Result<GgufTensorInfo, FormatError>

Source: formats.joule:752

fn read_tensor_data(&self, offset: u64, size: usize) -> Result<Vec<u8>, FormatError>

Source: formats.joule:774

fn create_mmap(file: &File) -> Result<MmapHandle, FormatError>

Source: formats.joule:795

fn quant_meta_from_dtype(dtype: GgufDType) -> Option<QuantizationMeta>

Source: formats.joule:830

fn quant_type_from_dtype(dtype: GgufDType) -> QuantType

Source: formats.joule:843

fn read_u8(file: &mut File) -> Result<u8, FormatError>

Source: formats.joule:869

fn read_i8(file: &mut File) -> Result<i8, FormatError>

Source: formats.joule:875

fn read_u16(file: &mut File) -> Result<u16, FormatError>

Source: formats.joule:879

fn read_i16(file: &mut File) -> Result<i16, FormatError>

Source: formats.joule:885

fn read_u32(file: &mut File) -> Result<u32, FormatError>

Source: formats.joule:891

fn read_i32(file: &mut File) -> Result<i32, FormatError>

Source: formats.joule:897

fn read_u64(file: &mut File) -> Result<u64, FormatError>

Source: formats.joule:903

fn read_i64(file: &mut File) -> Result<i64, FormatError>

Source: formats.joule:909

fn read_f32(file: &mut File) -> Result<f32, FormatError>

Source: formats.joule:915

fn read_f64(file: &mut File) -> Result<f64, FormatError>

Source: formats.joule:921

fn drop(&mut self)

Source: formats.joule:929

const SAFETENSORS_HEADER_SIZE_LEN: usize

SafeTensors magic bytes

Source: formats.joule:942

enum SafeTensorsDType

Source: formats.joule:946

fn from_str(s: &str) -> Option<Self>

Source: formats.joule:963

fn to_dtype(&self) -> DType

Source: formats.joule:982

fn size_bytes(&self) -> usize

Source: formats.joule:1000

struct SafeTensorInfo

Source: formats.joule:1013

struct SafeTensorsLoader

SafeTensors loader

Source: formats.joule:1021

fn open(path: impl AsRef<Path>) -> Result<Self, FormatError>

Source: formats.joule:1032

fn open_with_options(

Source: formats.joule:1038

fn tensor_names(&self) -> Vec<&str>

Get tensor names

Source: formats.joule:1079

fn tensor_info(&self, name: &str) -> Option<&SafeTensorInfo>

Get tensor info

Source: formats.joule:1084

fn tensors(&self) -> impl Iterator<Item = TensorMeta> + '_

List all tensor metadata

Source: formats.joule:1089

fn load_tensor(&self, name: &str) -> Result<Tensor, FormatError>

Source: formats.joule:1104

fn load_tensor_to_device(

Source: formats.joule:1118

fn load_all(&self) -> Result<HashMap<String, Tensor>, FormatError>

Source: formats.joule:1131

fn stream_tensors<F>(&self, mut callback: F) -> Result<(), FormatError>

Source: formats.joule:1144

fn total_parameters(&self) -> u64

Total parameter count

Source: formats.joule:1158

fn total_size_bytes(&self) -> u64

Total size in bytes

Source: formats.joule:1165

fn energy_scope(&self, op: &str) -> Option<EnergyScope>

Source: formats.joule:1173

fn parse_header(json: &str) -> Result<HashMap<String, SafeTensorInfo>, FormatError>

Source: formats.joule:1177

fn parse_tensor_entry(line: &str) -> Result<Option<SafeTensorInfo>, FormatError>

Source: formats.joule:1195

fn extract_json_string(line: &str, key: &str) -> Option<String>

Extract a JSON string value for a given key from a line.

Source: formats.joule:1256

fn extract_json_array_usize(line: &str, key: &str) -> Option<Vec<usize>>

Extract a JSON array of unsigned integers for a given key from a line.

Source: formats.joule:1270

fn read_tensor_data(&self, offset: usize, size: usize) -> Result<Vec<u8>, FormatError>

Source: formats.joule:1288

struct OnnxLoader

ONNX model loader (runtime-based)

Source: formats.joule:1313

struct OnnxGraphInfo

Source: formats.joule:1322

struct OnnxTensorSpec

Source: formats.joule:1332

fn open(path: impl AsRef<Path>) -> Result<Self, FormatError>

Source: formats.joule:1341

fn open_with_options(

Source: formats.joule:1347

fn graph_info(&self) -> &OnnxGraphInfo

Get graph info

Source: formats.joule:1367

fn inputs(&self) -> &[OnnxTensorSpec]

Get input specifications

Source: formats.joule:1372

fn outputs(&self) -> &[OnnxTensorSpec]

Get output specifications

Source: formats.joule:1377

fn tensors(&self) -> &[TensorMeta]

List initializer tensors

Source: formats.joule:1382

fn load_tensor(&self, name: &str) -> Result<Tensor, FormatError>

Source: formats.joule:1388

fn create_session(&self) -> Result<OnnxSession, FormatError>

Source: formats.joule:1400

fn energy_scope(&self, op: &str) -> Option<EnergyScope>

Source: formats.joule:1410

fn parse_onnx(path: &Path) -> Result<OnnxGraphInfo, FormatError>

Source: formats.joule:1414

fn extract_initializers(path: &Path) -> Result<Vec<TensorMeta>, FormatError>

Source: formats.joule:1422

struct OnnxSession

ONNX inference session

Source: formats.joule:1432

fn run(&self, inputs: HashMap<String, Tensor>) -> Result<HashMap<String, Tensor>, FormatError>

Source: formats.joule:1439

enum ModelLoader

Unified model loader that auto-detects format

Source: formats.joule:1453

fn open(path: impl AsRef<Path>) -> Result<Self, FormatError>

Source: formats.joule:1462

fn open_with_options(

Source: formats.joule:1468

fn tensor_names(&self) -> Vec<&str>

Get tensor names

Source: formats.joule:1490

fn load_tensor(&self, name: &str) -> Result<Tensor, FormatError>

Source: formats.joule:1500

fn load_all(&self) -> Result<HashMap<String, Tensor>, FormatError>

Source: formats.joule:1510

fn total_parameters(&self) -> u64

Total parameter count

Source: formats.joule:1527

fn total_size_bytes(&self) -> u64

Total size in bytes

Source: formats.joule:1536

fn load(path: impl AsRef<Path>) -> Result<HashMap<String, Tensor>, FormatError>

Source: formats.joule:1551

fn load_streaming<F>(path: impl AsRef<Path>, callback: F) -> Result<(), FormatError>

Source: formats.joule:1557

fn probe(path: impl AsRef<Path>) -> Result<Vec<TensorMeta>, FormatError>

Source: formats.joule:1571

fn estimate_memory(path: impl AsRef<Path>) -> Result<u64, FormatError>

Source: formats.joule:1582

fn estimate_load_energy(path: impl AsRef<Path>) -> Result<Joules, FormatError>

Source: formats.joule:1588