Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gguf] Add types #562

Merged
merged 3 commits into from Mar 20, 2024
Merged

[gguf] Add types #562

merged 3 commits into from Mar 20, 2024

Conversation

mishig25
Copy link
Collaborator

@mishig25 mishig25 commented Mar 19, 2024

GGUF add types. Follow up to #540 (comment).

No any kind of validation, just types

cc: @biw also

@mishig25 mishig25 marked this pull request as ready for review March 19, 2024 17:01
Comment on lines +4 to +5
export type { MetadataValue, Version, GGUFMetadata, GGUFTensorInfo, GGUFParseOutput } from "./types";
export { GGUFValueType, GGMLQuantizationType } from "./types";
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

is it a correct way to re-export ?

Comment on lines +6 to +29
export enum GGMLQuantizationType {
F32 = 0,
F16 = 1,
Q4_0 = 2,
Q4_1 = 3,
Q5_0 = 6,
Q5_1 = 7,
Q8_0 = 8,
Q8_1 = 9,
Q2_K = 10,
Q3_K = 11,
Q4_K = 12,
Q5_K = 13,
Q6_K = 14,
Q8_K = 15,
IQ2_XXS = 16,
IQ2_XS = 17,
IQ3_XXS = 18,
IQ1_S = 19,
IQ4_NL = 20,
IQ3_S = 21,
IQ2_S = 22,
IQ4_XS = 23,
}
Copy link
Member

Choose a reason for hiding this comment

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

enums are not strictly speaking types as they expose objects in the runtime.

End of not super useful pedantic note haha. cc @coyotte508

export type RWKV = ModelBase<"rwkv"> & { "rwkv.architecture_version": number };
export type LLM = TransformerLLM | RWKV;
export type Whisper = ModelBase<"encoder.whisper"> & ModelBase<"decoder.whisper">;
export type Model = (LLM | Whisper) & Partial<Tokenizer>;
Copy link
Member

Choose a reason for hiding this comment

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

very neat types (though they make my head hurt a bit, lol)

Comment on lines +48 to +57
"llama",
"mpt",
"gptneox",
"gptj",
"gpt2",
"bloom",
"falcon",
"gemma",
"rwkv",
"whisper",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"llama",
"mpt",
"gptneox",
"gptj",
"gpt2",
"bloom",
"falcon",
"gemma",
"rwkv",
"whisper",
"llama",
"falcon",
"baichuan",
"gpt2",
"gptj",
"gptneox",
"mpt",
"starcoder",
"persimmon",
"refact",
"bert",
"nomic-bert",
"bloom",
"stablelm",
"qwen",
"qwen2",
"phi2",
"plamo",
"codeshell",
"orion",
"internlm2",
"minicpm",
"gemma",
"starcoder2",
"mamba",

Copy link
Member

Choose a reason for hiding this comment

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

(optional, but it's the current list from the llama.cpp source of truth IIUC)

Copy link
Member

@julien-c julien-c left a comment

Choose a reason for hiding this comment

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

i would merge as is and iterate later

@mishig25 mishig25 merged commit e745ba5 into main Mar 20, 2024
2 checks passed
@mishig25 mishig25 deleted the gguf_types branch March 20, 2024 12:32
mishig25 added a commit that referenced this pull request Mar 21, 2024
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.

None yet

2 participants