Expand description
GGUF Export (spec §7.2)
Pure Rust writer for GGUF format (llama.cpp compatible). WASM compatible - no C/C++ dependencies.
§Format Structure
┌─────────────────────────────────────────┐
│ Magic: "GGUF" (4 bytes) │
│ Version: u32 (currently 3) │
│ Tensor count: u64 │
│ Metadata KV count: u64 │
├─────────────────────────────────────────┤
│ Metadata KV pairs │
├─────────────────────────────────────────┤
│ Tensor info array │
├─────────────────────────────────────────┤
│ Tensor data (aligned) │
└─────────────────────────────────────────┘Reference: [GGUF2023] Gerganov, G. (2023). GGUF Format.
Structs§
- Gguf
Header - GGUF file header
- Gguf
Tensor - A tensor to be exported to GGUF format
- Gguf
Tensor Info - GGUF tensor info
Enums§
- Ggml
Type - GGUF tensor types (from ggml)
- Gguf
Value - GGUF metadata value
- Gguf
Value Type - GGUF value types (from ggml)
Constants§
- GGUF_
DEFAULT_ ALIGNMENT - Default alignment for tensor data
- GGUF_
MAGIC - GGUF magic number: “GGUF” in little-endian
- GGUF_
VERSION - GGUF format version (v3 is current)
Functions§
- export_
tensors_ to_ gguf - Export tensors to GGUF format
- padding_
for_ alignment - Calculate padding bytes needed for alignment
- write_
metadata_ kv - Write a metadata key-value pair