Archived
core/format, tools: GGUF Q8_0, Q4_K and Q6_K tensors import as their planes -- rad-convert writes them without a recipe
A GGUF tensor of block type Q8_0, Q4_K or Q6_K could only be dequantised, so rad-convert reached it through a recipe rule and re-quantised what was already quantised. ckpt_resolve now states the planes libquant's ggml quantiser writes for the same blocks and marks the weight imported, and ckpt_plane_rows splits each row's blocks into them bit for bit. The split is core/format/ggml_planes.h, the reader's copy of lq_ggml's unpack functions, since the core cannot call libquant; a type there is one table row, its planes and its split. Pieces of one block type joined along rows import, an expert's slices of a stacked tensor included; mixed types and column joins keep a GGUF reason. The weight is not trivial, so the loader refuses it with the hint to serve the container rad-convert writes, and ckpt_rows_f32 still dequantises it for a recipe. A rule that declines such a weight is an error in rad-convert, since keeping its planes would hide that the rule did not apply (spec.md §4.4). Tests: quant_ggml_test holds every type of the reader's table to the quantiser's encoding, checkpoint_test decodes the planes of Q8_0, Q4_K (one-block rows and a row join) and Q6_K against the block definition and holds an expert's gate|up, two slices of stacked Q4_K tensors, to the same blocks stored on their own, and convert_test runs a declining rule over a Q8_0 tensor, with the GGUF writer moved to tests/gguf_writer.h for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6f034d989f
commit
385318f81a
10 files changed
+602
-57
No files matched your search
@@ -659,6 +659,10 @@ same path runs. Trivial means served as stored:
|
||||
`fp4_e2m1*e8m0[1x32]`, byte for byte;
|
||||
- GGUF `F32`, `F16` and `BF16`.
|
||||
|
||||
A GGUF `Q8_0`, `Q4_K` or `Q6_K` tensor is not trivial, because its blocks interleave what the planes
|
||||
of §4.1 hold apart. `rad-convert` imports it without a recipe as those planes, bit for bit, and the
|
||||
loader refuses it with that hint. Other GGUF block types are dequantised for a recipe or refused.
|
||||
|
||||
**A torch.save file beside the safetensors is read as data** (`core/format/torch_zip.h`), for a
|
||||
model part that ships only that way (Fish Audio drama-3's `codec.pth`): its tensors join the
|
||||
namespace under `<stem>.`. The zip's stored entries are mapped, and its pickle is read by a machine
|
||||
@@ -697,7 +701,9 @@ A rule names an algorithm (`rtn`, `gptq`, `cast`); its options name the grid (`c
|
||||
`group` or `block`, `scale`, a second level `scale2`, `zero`, `rule`) and the transform
|
||||
(`transform=fwht128`) (§4.5). First match wins, so a protected expert's `cast` rule sits above the
|
||||
rule every other expert takes. A quantiser that declines a weight (`rtn` declines a rank-1 tensor)
|
||||
leaves it to the checkpoint's encoding, so a broad pattern need not exclude every norm.
|
||||
leaves it to the checkpoint's encoding, so a broad pattern need not exclude every norm. A GGUF block
|
||||
tensor is the exception: a rule that declines it is an error, since keeping its planes would hide
|
||||
that the rule did not apply.
|
||||
|
||||
`--recipe FILE` names a file and `--quant 'PATTERN=QUANTISER:k=v,...'` adds rules ahead of it.
|
||||
`$NAME` in an option is read from the environment.
|
||||
|
||||
Reference in new issue
Block a user