Skip to main content

Module file

Module file 

Source
Expand description

GgufFile: mmap-backed reader for a single GGUF file.

Lifecycle:

  1. GgufFile::open(path) — mmaps the file and parses the header. No tensor payloads are read at this stage.
  2. architecture(), metadata_*(), tensor_names(), tensor_info() — cheap lookups, all served from the parsed header in memory.
  3. read_tensor(name, device) — slices the mmap at the right offset and asks candle to materialise a QTensor (still quantized).

Tensor reads only need a shared &self because the mmap is immutable; the file is safe to share across threads. (Candle’s Content::tensor wants a &mut R: Read + Seek, but we satisfy it with a fresh Cursor<&[u8]> on each call — the cursor’s mutable state is local to the call.)

Structs§

GgufFile
Read-only handle to a memory-mapped GGUF file.