-
Notifications
You must be signed in to change notification settings - Fork 0
GGUF Parsing
Raul Montoya Cardenas edited this page Jul 29, 2026
·
2 revisions
Modules: src/gguf/{mod,cursor,layout,tensor}.rs.
| Function | Behavior |
|---|---|
load_gguf(path) |
fs::read whole file → parse_bytes
|
parse_bytes(bytes, path) |
Parse in-memory buffer; path for errors |
-
Header — magic
GGUF, version 3,tensor_count,kv_count(bounded ≤ 1_000_000 each) -
KV metadata — strings / numerics / f32 / f64 maps; arrays skipped;
general.alignmentsets alignment (default 32) -
Tensor directory — name, dims (≤ 8),
ggml_type, relative offset →Tensormetadata -
Finalize — align cursor to compute
tensor_data_offsetand absolute offsets
| Field | Meaning |
|---|---|
path |
Source path for diagnostics |
metadata |
GgufMetadata |
tensors |
HashMap<String, Tensor> |
alignment |
File alignment |
tensor_data_offset |
Start of payload region |
bytes |
Full file contents |
Helpers: tensor(name), tensor_bytes(&Tensor), find_tensors_with_suffix(suffix).
-
architecture()→general.architectureor"unknown" -
numeric(key)→Option<usize>from coerced u64 map
GgufCursor — little-endian scalars, length-prefixed UTF-8 strings, numeric coercion, skip_value for arrays/unknowns.
Last updated: July 29, 2026
Updated by: Grok Build: Grok 4.5
Package tip reference: 07a5558 (main)