Expand description
Canonical dtype casting for GGUF conversion: {F32, F16, BF16} sources to any
writable GGMLType, including Q8_0 block quantization. Bit-for-bit the same
math as the per-model converters (which predate this crate and keep their own
verified copies).
Enums§
- SrcDtype
- Source dtype of raw checkpoint tensor bytes.
Functions§
- cast_
data - Cast raw little-endian tensor bytes from
srctodst. - cast_
with_ q8_ fallback - Cast with automatic Q8_0 fallback. Returns
(bytes, actual_dtype, fell_back). - decode_
to_ f32 - Decode raw bytes of
srcdtype into f32 values (exact for all three sources). - f16_
to_ f32 - f32_
to_ bf16_ bits - Round-to-nearest-even F32→BF16 with NaN preservation.
- f32_
to_ bytes - f32_
to_ f16_ bits - q8_
dst_ or_ fallback - Q8_0 block-quantization fallback: tensors whose innermost dim or total
element count is not a multiple of 32 stay F32. Centralizes the
innermost % 32check duplicated ingeneric.rs, the Pythonwrite_generic_gguf, and every per-modelconvert.rs. - quantize_
q8_ 0