mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 15:33:56 +08:00
test(model): reuse empty GGUF fixture bytes (#17325)
This commit is contained in:
@@ -994,13 +994,9 @@ cliTest(
|
||||
);
|
||||
const emptyGgufHeader = ggufFixture({ tensors: [], metadata: [] });
|
||||
const alignedOffset = Math.ceil(emptyGgufHeader.header.length / 32) * 32;
|
||||
const emptyGguf = Buffer.concat([
|
||||
emptyGgufHeader.header,
|
||||
Buffer.alloc(alignedOffset - emptyGgufHeader.header.length),
|
||||
]);
|
||||
for (const [name, bytes] of [
|
||||
["optional.safetensors", safetensors.bytes],
|
||||
["empty.gguf", emptyGguf],
|
||||
["empty.gguf", emptyGgufHeader.bytes],
|
||||
] as const) {
|
||||
const path = join(root, name);
|
||||
await writeFile(path, bytes);
|
||||
|
||||
@@ -267,11 +267,7 @@ it.each([8, 24, 40])(
|
||||
it("aligns the GGUF data section after an empty tensor directory", async () => {
|
||||
const base = ggufFixture({ tensors: [], metadata: [] });
|
||||
const dataOffset = Math.ceil(base.header.length / 32) * 32;
|
||||
const bytes = Buffer.concat([
|
||||
base.header,
|
||||
Buffer.alloc(dataOffset - base.header.length),
|
||||
]);
|
||||
const report = await readFixtureHeader(bytes);
|
||||
const report = await readFixtureHeader(base.bytes);
|
||||
expect(report.tensors).toEqual([]);
|
||||
expect(report.tensor_data_offset).toBe(dataOffset);
|
||||
expect(report.artifact.header_length).toBe(base.header.length);
|
||||
|
||||
Reference in New Issue
Block a user