ggml : designate enum vals for integer types (#6050)

This commit is contained in:
Georgi Gerganov 2024-03-14 12:38:37 +02:00 committed by GitHub
parent 68265ebfc6
commit 3fe8d7a17f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

64
ggml.h
View File

@ -337,24 +337,24 @@ extern "C" {
struct ggml_object; struct ggml_object;
struct ggml_context; struct ggml_context;
// NOTE: always add types at the end of the enum to keep backward compatibility
enum ggml_type { enum ggml_type {
GGML_TYPE_F32 = 0, GGML_TYPE_F32 = 0,
GGML_TYPE_F16 = 1, GGML_TYPE_F16 = 1,
GGML_TYPE_Q4_0 = 2, GGML_TYPE_Q4_0 = 2,
GGML_TYPE_Q4_1 = 3, GGML_TYPE_Q4_1 = 3,
// GGML_TYPE_Q4_2 = 4, support has been removed // GGML_TYPE_Q4_2 = 4, support has been removed
// GGML_TYPE_Q4_3 (5) support has been removed // GGML_TYPE_Q4_3 = 5, support has been removed
GGML_TYPE_Q5_0 = 6, GGML_TYPE_Q5_0 = 6,
GGML_TYPE_Q5_1 = 7, GGML_TYPE_Q5_1 = 7,
GGML_TYPE_Q8_0 = 8, GGML_TYPE_Q8_0 = 8,
GGML_TYPE_Q8_1 = 9, GGML_TYPE_Q8_1 = 9,
// k-quantizations GGML_TYPE_Q2_K = 10,
GGML_TYPE_Q2_K = 10, GGML_TYPE_Q3_K = 11,
GGML_TYPE_Q3_K = 11, GGML_TYPE_Q4_K = 12,
GGML_TYPE_Q4_K = 12, GGML_TYPE_Q5_K = 13,
GGML_TYPE_Q5_K = 13, GGML_TYPE_Q6_K = 14,
GGML_TYPE_Q6_K = 14, GGML_TYPE_Q8_K = 15,
GGML_TYPE_Q8_K = 15,
GGML_TYPE_IQ2_XXS = 16, GGML_TYPE_IQ2_XXS = 16,
GGML_TYPE_IQ2_XS = 17, GGML_TYPE_IQ2_XS = 17,
GGML_TYPE_IQ3_XXS = 18, GGML_TYPE_IQ3_XXS = 18,
@ -363,9 +363,9 @@ extern "C" {
GGML_TYPE_IQ3_S = 21, GGML_TYPE_IQ3_S = 21,
GGML_TYPE_IQ2_S = 22, GGML_TYPE_IQ2_S = 22,
GGML_TYPE_IQ4_XS = 23, GGML_TYPE_IQ4_XS = 23,
GGML_TYPE_I8, GGML_TYPE_I8 = 24,
GGML_TYPE_I16, GGML_TYPE_I16 = 25,
GGML_TYPE_I32, GGML_TYPE_I32 = 26,
GGML_TYPE_COUNT, GGML_TYPE_COUNT,
}; };
@ -383,20 +383,20 @@ extern "C" {
// model file types // model file types
enum ggml_ftype { enum ggml_ftype {
GGML_FTYPE_UNKNOWN = -1, GGML_FTYPE_UNKNOWN = -1,
GGML_FTYPE_ALL_F32 = 0, GGML_FTYPE_ALL_F32 = 0,
GGML_FTYPE_MOSTLY_F16 = 1, // except 1d tensors GGML_FTYPE_MOSTLY_F16 = 1, // except 1d tensors
GGML_FTYPE_MOSTLY_Q4_0 = 2, // except 1d tensors GGML_FTYPE_MOSTLY_Q4_0 = 2, // except 1d tensors
GGML_FTYPE_MOSTLY_Q4_1 = 3, // except 1d tensors GGML_FTYPE_MOSTLY_Q4_1 = 3, // except 1d tensors
GGML_FTYPE_MOSTLY_Q4_1_SOME_F16 = 4, // tok_embeddings.weight and output.weight are F16 GGML_FTYPE_MOSTLY_Q4_1_SOME_F16 = 4, // tok_embeddings.weight and output.weight are F16
GGML_FTYPE_MOSTLY_Q8_0 = 7, // except 1d tensors GGML_FTYPE_MOSTLY_Q8_0 = 7, // except 1d tensors
GGML_FTYPE_MOSTLY_Q5_0 = 8, // except 1d tensors GGML_FTYPE_MOSTLY_Q5_0 = 8, // except 1d tensors
GGML_FTYPE_MOSTLY_Q5_1 = 9, // except 1d tensors GGML_FTYPE_MOSTLY_Q5_1 = 9, // except 1d tensors
GGML_FTYPE_MOSTLY_Q2_K = 10, // except 1d tensors GGML_FTYPE_MOSTLY_Q2_K = 10, // except 1d tensors
GGML_FTYPE_MOSTLY_Q3_K = 11, // except 1d tensors GGML_FTYPE_MOSTLY_Q3_K = 11, // except 1d tensors
GGML_FTYPE_MOSTLY_Q4_K = 12, // except 1d tensors GGML_FTYPE_MOSTLY_Q4_K = 12, // except 1d tensors
GGML_FTYPE_MOSTLY_Q5_K = 13, // except 1d tensors GGML_FTYPE_MOSTLY_Q5_K = 13, // except 1d tensors
GGML_FTYPE_MOSTLY_Q6_K = 14, // except 1d tensors GGML_FTYPE_MOSTLY_Q6_K = 14, // except 1d tensors
GGML_FTYPE_MOSTLY_IQ2_XXS = 15, // except 1d tensors GGML_FTYPE_MOSTLY_IQ2_XXS = 15, // except 1d tensors
GGML_FTYPE_MOSTLY_IQ2_XS = 16, // except 1d tensors GGML_FTYPE_MOSTLY_IQ2_XS = 16, // except 1d tensors
GGML_FTYPE_MOSTLY_IQ3_XXS = 17, // except 1d tensors GGML_FTYPE_MOSTLY_IQ3_XXS = 17, // except 1d tensors