Skip to content

Conversation

@mishig25
Copy link
Collaborator

@mishig25 mishig25 commented Oct 16, 2024

Moving this function from moon to hf.js/gguf as I need it for #687

const quantLabel = parseGGUFQuantLabel("abc-Q4.gguf")
console.log(quantLabel)
// Q4

Order of operations

@mishig25 mishig25 requested a review from ngxson October 16, 2024 08:53
@mishig25 mishig25 marked this pull request as ready for review October 16, 2024 08:53
@mishig25 mishig25 requested a review from julien-c as a code owner October 16, 2024 08:53
@mishig25 mishig25 mentioned this pull request Oct 16, 2024
expect(parseGGUFQuantLabel("subdir/Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf")).toEqual("Q4_K_M");
expect(parseGGUFQuantLabel("Codestral-22B-v0.1-Q2_K.gguf")).toEqual("Q2_K");
expect(parseGGUFQuantLabel("Codestral-22B-v0.1gguf")).toEqual(undefined);
expect(parseGGUFQuantLabel("Codestral-22B-v0.1-F32-Q2_K.gguf")).toEqual("Q2_K"); // gguf name with two quant labels [F32, Q2_K]
Copy link
Member

@ngxson ngxson Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some interesting test cases that can be added:

Suggested change
expect(parseGGUFQuantLabel("Codestral-22B-v0.1-F32-Q2_K.gguf")).toEqual("Q2_K"); // gguf name with two quant labels [F32, Q2_K]
expect(parseGGUFQuantLabel("Codestral-22B-v0.1-F32-Q2_K.gguf")).toEqual("Q2_K"); // gguf name with two quant labels [F32, Q2_K]
expect(parseGGUFQuantLabel("Codestral-22B-v0.1-IQ3_XS.gguf")).toEqual("IQ3_XS");
expect(parseGGUFQuantLabel("Codestral-22B-v0.1-Q4_0_4_4.gguf")).toEqual("Q4_0_4_4");

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to push ed2a0df

because parseGGUFQuantLabel is based on what's typed in enum ggml_type. And IQ3_XS , Q4_0_4_4 does not exist in enum ggml_type atm. However, I do see that Codestral-22B-v0.1-IQ3_XS.gguf is on the hub. I'd say: we should merge this PR and try to handle these edge cases in subseq PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok no problem for me, AFAIK not many users use the Q4_0_4_4 stuff-

@mishig25 mishig25 merged commit 0d96120 into main Oct 16, 2024
4 of 5 checks passed
@mishig25 mishig25 deleted the parse_quant_label branch October 16, 2024 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants