Skip to main content

Module gguf

Module gguf 

Source
Expand description

A read-only GGUF reader: the whole metadata table, typed, the tensor directory, and every tensor’s weights in the formats super::quant::GgmlType reads.

GGUF layout: "GGUF" magic, u32 version, u64 tensor count, u64 metadata count, the metadata key/value pairs, the tensor infos (name, dims, ggml type, offset), then — aligned to general.alignment — the tensor data. Metadata keys of the model’s architecture are prefixed by general.architecture (qwen3.block_count); the tokenizer’s live under tokenizer.ggml.*. Nothing is skipped: a tokenizer, a chat template and every architecture key are readable by name.

Structs§

Arch
The transformer architecture fields the hand-written model lanes read from GGUF metadata. Every field is a key under the architecture prefix and reads 0 (or the documented default) when absent.
Gguf
A parsed GGUF file: the metadata, the tensor directory, and where the data section starts.
TensorInfo
One tensor’s entry in the directory.
TensorOut
One tensor a written GGUF holds: its name, dims (dims[0] the fastest) and format.

Enums§

MetaValue
One metadata value.

Functions§

fnv1a64
FNV-1a over 64 bits.
write
Write a GGUF v3 file: the metadata in the order given, the tensor directory, then each tensor’s bytes — asked of data one tensor at a time, so a checkpoint is never held whole — each aligned to general.alignment (32 when absent).