fix(model): recognize F8_E4M3 GGUF tensors from ggml v0.29.0

This commit is contained in:
Iain authored and Ysopwnable committed 2026-11-21 22:01:42 +01:00
1 parent 339f0ace57
commit afc040cceb
2 files changed
+5 -2

No files matched your search

+2 -1
View File
@@ -24,7 +24,7 @@ const ambiguousGgmlType = (id: number, candidates: string): GgmlType => [
},
];
/** Modern names/sizes: ggml da8e2a54 enum and block sizeof assertions.
/** Modern names/sizes: ggml 57e2c2ca (v0.29.0) enum and block sizeof assertions.
* Historical collisions: llama.cpp b1500/b1803/b1871/b2100/b2172/b2221/
* b2253/b2275/b2300. Their GGUF v3 / quantization v2 do not select a layout.
* A common row multiple is necessary, but need not be a known storage block.
@@ -77,6 +77,7 @@ const GGML_TYPES: Readonly<Record<number, GgmlType>> = {
40: ["NVFP4", 64, 36],
41: ["Q1_0", 128, 18],
42: ["Q2_0", 64, 18],
43: ["F8_E4M3", 1, 1],
};
export const ggmlType = (id: number): GgmlType | undefined => GGML_TYPES[id];
+3 -1
View File
@@ -723,6 +723,7 @@ it("retains established storage for stable GGUF types and zero-byte K declaratio
{ name: "integer", type: 26, shape: [3n], offset: 0n, bytes: 12 },
{ name: "empty-k", type: 10, shape: [64n, 0n], offset: 32n, bytes: 0 },
{ name: "quant", type: 2, shape: [32n], offset: 32n, bytes: 18 },
{ name: "fp8", type: 43, shape: [3n], offset: 64n, bytes: 3 },
],
});
const { provider, path } = await providerAt(fixture.bytes);
@@ -732,8 +733,9 @@ it("retains established storage for stable GGUF types and zero-byte K declaratio
{ type: "I32", byte_length: 12, storage_validation: "consistent" },
{ type: "Q2_K", byte_length: 0, storage_validation: "consistent" },
{ type: "Q4_0", byte_length: 18, storage_validation: "consistent" },
{ type: "F8_E4M3", byte_length: 3, storage_validation: "consistent" },
]);
expect(result.value.totals.tensor_bytes).toBe(30);
expect(result.value.totals.tensor_bytes).toBe(33);
expect(result.value.coverage).toMatchObject({
tensor_ranges: "complete",
storage_sizes: "complete",