Expand description
ggml is a semi-idiomatic wrapper for the ggml C library.
It exposes a subset of operations (currently used to implement the llm library). Note that it does not expose a fully-idiomatic safe Rust interface; operations that could be potentially unsafe are marked as such.
ggml operates on a computational graph; no values will be computed until Context::graph_compute is executed.
All Tensors are nodes in this computational graph, and values cannot be retrieved until computation is completed.
Modules§
Structs§
- Buffer
- A buffer of memory that can be used as a scratch buffer for a Context.
- Computation
Graph - A
ggmlcomputation graph. Keeps track of all state during computation. - Context
- Acts as a RAII-guard over a
sys::ggml_context, allocating viaggml_initand dropping viaggml_free. - Quantization
Result - Contains the result of a quantization operation.
- Tensor
- Tensors are owned by the context. A tensor is alive as long as the underlying context it was created with is alive.
Enums§
- Container
Type - The format of the file containing the model.
- Type
- The type of a value in
ggml.
Constants§
- FILE_
MAGIC_ GGJT - Magic constant for
ggmlfiles (versioned, ggjt). - FILE_
MAGIC_ GGMF - Magic constant for
ggmlfiles (versioned, ggmf). - FILE_
MAGIC_ UNVERSIONED - Magic constant for
ggmlfiles (unversioned). - FORMAT_
VERSION - The currently-supported format version for
ggmlfiles. - OBJECT_
SIZE - The size of a
ggmlobject.
Functions§
- blck_
size - The size of a block for
t. Only relevant for quantized types. - quantize_
q4_ 0 - Quantizes
srcintodstusingq4_0quantization. - quantize_
q4_ 1 - Quantizes
srcintodstusingq4_1quantization. - type_
size - The size of
tas bytes. - type_
sizef - type_size/blck_size as float.
Type Aliases§
- Element
Type - The type of a tensor element.