mirror of
https://github.com/morluto/rea.git
synced 2026-11-04 22:06:10 +00:00
fix(model): preserve unsupported GGUF version diagnostics (#5789)
Preserve unsupported GGUF version bytes and both UINT32 interpretations without inventing byte order at the shared parser. Keep existing layout support, typed errors, evidence identity, scoped reads and resource limits. Validation: 78 focused tests, full static/architecture and documentation checks, real CLI/MCP version controls and an independently checked public model. Latest-head Codex found no issues; Greptile is 5/5 and all review threads are resolved. Some CI remained pending at merge qualification. Merge under the human owner's explicit standing bypass authorization does not claim the full CI suite passed. Fixes #5749.
This commit is contained in:
1 parent
bd8d73ab1d
commit
25bea07b42
3 files changed
+68
-7
No files matched your search
+12
-7
@@ -247,16 +247,21 @@ export class GgufHeader {
|
||||
tensors: ModelTensor[];
|
||||
}> {
|
||||
const versionBytes = await this.reader.take(4);
|
||||
this.#little =
|
||||
versionBytes.readUInt32LE() === 2 || versionBytes.readUInt32LE() === 3;
|
||||
const version = this.#little
|
||||
? versionBytes.readUInt32LE()
|
||||
: versionBytes.readUInt32BE();
|
||||
if (version !== 2 && version !== 3)
|
||||
const littleVersion = versionBytes.readUInt32LE();
|
||||
const bigVersion = versionBytes.readUInt32BE();
|
||||
let version: number;
|
||||
if (littleVersion === 2 || littleVersion === 3) {
|
||||
this.#little = true;
|
||||
version = littleVersion;
|
||||
} else if (bigVersion === 2 || bigVersion === 3) {
|
||||
this.#little = false;
|
||||
version = bigVersion;
|
||||
} else {
|
||||
throw new ModelFormatFailure(
|
||||
"unsupported",
|
||||
`GGUF version ${String(version)} is unsupported; supported versions are 2 and 3`,
|
||||
`GGUF version bytes ${versionBytes.toString("hex")} are unsupported (little-endian ${String(littleVersion)}, big-endian ${String(bigVersion)}; byte order unknown); supported versions are 2 and 3`,
|
||||
);
|
||||
}
|
||||
if (!this.#little && version !== 3)
|
||||
rejectModel("Big-endian GGUF requires version 3");
|
||||
const tensorCount = await this.#unsigned(8);
|
||||
|
||||
Reference in new issue
Block a user