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
ggml
computation graph. Keeps track of all state during computation. - Context
- Acts as a RAII-guard over a
sys::ggml_context
, allocating viaggml_init
and 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
ggml
files (versioned, ggjt). - FILE_
MAGIC_ GGMF - Magic constant for
ggml
files (versioned, ggmf). - FILE_
MAGIC_ UNVERSIONED - Magic constant for
ggml
files (unversioned). - FORMAT_
VERSION - The currently-supported format version for
ggml
files. - OBJECT_
SIZE - The size of a
ggml
object.
Functions§
- blck_
size - The size of a block for
t
. Only relevant for quantized types. - quantize_
q4_ 0 - Quantizes
src
intodst
usingq4_0
quantization. - quantize_
q4_ 1 - Quantizes
src
intodst
usingq4_1
quantization. - type_
size - The size of
t
as bytes. - type_
sizef - type_size/blck_size as float.
Type Aliases§
- Element
Type - The type of a tensor element.