gizlang/ggml
llama.cpp's IQ block types and Q8_K, decoded to their values (ggml-quants.c, dequantize_row_*). An IQ block of 256 elements holds, for each 8 (IQ3: 4) of them, an index into a grid of magnitudes with their signs and a scale for each 32. The grids are llama.cpp's tables (ggml-common.h; MIT, third-party/ggml.txt). gizlang/safetensors reads the other block types; its decoded takes these too.
import * as Ggml from "gizlang/ggml";Functions
blockOf
function blockOf(dtype: string): Vec<i64>The elements and bytes of a block of dtype (an IQ type or Q8_K), or [0, 0] for another type.
Effects: fail, alloc.
decodeBlock
function decodeBlock(dtype: string, data: bytes, at: i64, out: mut Vec<f32>, o: i64): voidThe block of dtype (blockOf) at byte at of data into out[o, o + its elements).
Effects: fail, read, write, console, io, alloc.