#[non_exhaustive]pub enum GgmlType {
Show 29 variants
F32,
F16,
Q4_0,
Q4_1,
Q5_0,
Q5_1,
Q8_0,
Q8_1,
Q2_K,
Q3_K,
Q4_K,
Q5_K,
Q6_K,
Q8_K,
IQ2_XXS,
IQ2_XS,
IQ3_XXS,
IQ1_S,
IQ4_NL,
IQ3_S,
IQ2_S,
IQ4_XS,
I8,
I16,
I32,
I64,
F64,
IQ1_M,
BF16,
}Expand description
A GGUF tensor element type, identified by its ggml_type integer
ID. Each variant maps 1:1 to a [prism::tensor::dtype] shape.
Variant spellings deliberately mirror the GGML ggml_type enum and
the prism::tensor::dtype type names (Q4_0, IQ4_NL, …) rather
than Rust camel case, so the mapping reads 1:1 against the
authoritative source.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
F32
GGML_TYPE_F32 (ID 0) → [F32].
F16
GGML_TYPE_F16 (ID 1) → [F16].
Q4_0
GGML_TYPE_Q4_0 (ID 2) → [Q4_0].
Q4_1
GGML_TYPE_Q4_1 (ID 3) → [Q4_1].
Q5_0
GGML_TYPE_Q5_0 (ID 6) → [Q5_0].
Q5_1
GGML_TYPE_Q5_1 (ID 7) → [Q5_1].
Q8_0
GGML_TYPE_Q8_0 (ID 8) → [Q8_0].
Q8_1
GGML_TYPE_Q8_1 (ID 9) → [Q8_1].
Q2_K
GGML_TYPE_Q2_K (ID 10) → [Q2_K].
Q3_K
GGML_TYPE_Q3_K (ID 11) → [Q3_K].
Q4_K
GGML_TYPE_Q4_K (ID 12) → [Q4_K].
Q5_K
GGML_TYPE_Q5_K (ID 13) → [Q5_K].
Q6_K
GGML_TYPE_Q6_K (ID 14) → [Q6_K].
Q8_K
GGML_TYPE_Q8_K (ID 15) → [Q8_K].
IQ2_XXS
GGML_TYPE_IQ2_XXS (ID 16) → [IQ2_XXS].
IQ2_XS
GGML_TYPE_IQ2_XS (ID 17) → [IQ2_XS].
IQ3_XXS
GGML_TYPE_IQ3_XXS (ID 18) → [IQ3_XXS].
IQ1_S
GGML_TYPE_IQ1_S (ID 19) → [IQ1_S].
IQ4_NL
GGML_TYPE_IQ4_NL (ID 20) → [IQ4_NL].
IQ3_S
GGML_TYPE_IQ3_S (ID 21) → [IQ3_S].
IQ2_S
GGML_TYPE_IQ2_S (ID 22) → [IQ2_S].
IQ4_XS
GGML_TYPE_IQ4_XS (ID 23) → [IQ4_XS].
I8
GGML_TYPE_I8 (ID 24) → [I8].
I16
GGML_TYPE_I16 (ID 25) → [I16].
I32
GGML_TYPE_I32 (ID 26) → [I32].
I64
GGML_TYPE_I64 (ID 27) → [I64].
F64
GGML_TYPE_F64 (ID 28) → [F64].
IQ1_M
GGML_TYPE_IQ1_M (ID 29) → [IQ1_M].
BF16
GGML_TYPE_BF16 (ID 30) → [BF16].
Implementations§
Source§impl GgmlType
impl GgmlType
Sourcepub const fn from_u32(id: u32) -> Option<Self>
pub const fn from_u32(id: u32) -> Option<Self>
Map a raw ggml_type integer ID to a GgmlType.
Returns None for IDs outside the GGUF v3 tensor-type set —
including the deprecated IDs 4 and 5.
Sourcepub const fn block_bytes(self) -> usize
pub const fn block_bytes(self) -> usize
Bytes per block, sourced from the [prism::tensor::dtype] shape.
Sourcepub const fn block_elems(self) -> usize
pub const fn block_elems(self) -> usize
Elements per block, sourced from the [prism::tensor::dtype]
shape.
Sourcepub const fn tensor_data_bytes(self, num_elements: u64) -> Option<u64>
pub const fn tensor_data_bytes(self, num_elements: u64) -> Option<u64>
The total byte count for a tensor of num_elements of this
dtype: (num_elements / BLOCK_ELEMS) * BLOCK_BYTES. Returns
None if num_elements is not a whole multiple of
BLOCK_ELEMS (a malformed quantized tensor) or on overflow.