Skip to content

Commit bcc6599

Browse files
committed
add test
1 parent bec0439 commit bcc6599

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

packages/gguf/src/gguf.spec.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import { beforeAll, describe, expect, it } from "vitest";
22
import type { GGUFParseOutput } from "./gguf";
3-
import { GGMLFileQuantizationType, GGMLQuantizationType, gguf, ggufAllShards, parseGgufShardFilename } from "./gguf";
3+
import {
4+
GGMLFileQuantizationType,
5+
GGMLQuantizationType,
6+
gguf,
7+
ggufAllShards,
8+
parseGgufShardFilename,
9+
parseGGUFQuantLabel,
10+
} from "./gguf";
411
import fs from "node:fs";
512

613
const URL_LLAMA = "https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/191239b/llama-2-7b-chat.Q2_K.gguf";
@@ -266,4 +273,11 @@ describe("gguf", () => {
266273
const { parameterCount } = await ggufAllShards(URL_SHARDED_GROK);
267274
expect(parameterCount).toEqual(316_490_127_360); // 316B
268275
});
276+
277+
it("parse quant label", async () => {
278+
expect(parseGGUFQuantLabel("Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf")).toEqual("Q4_K_M");
279+
expect(parseGGUFQuantLabel("subdir/Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf")).toEqual("Q4_K_M");
280+
expect(parseGGUFQuantLabel("Codestral-22B-v0.1-Q2_K.gguf")).toEqual("Q2_K");
281+
expect(parseGGUFQuantLabel("Codestral-22B-v0.1gguf")).toEqual(undefined);
282+
});
269283
});

0 commit comments

Comments
 (0)