Skip to content

Commit 6b38a72

Browse files
giuseppepwilkin
authored andcommitted
model : add Granite Hybrid types (ggml-org#16635)
add Granite 4 models mapping their embedding dimensions to the # of parameters. Information taken from https://huggingface.co/ibm-granite/granite-4.0-h-tiny Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
1 parent 0aa82c5 commit 6b38a72

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/llama-model.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ const char * llm_type_name(llm_type type) {
202202
case LLM_TYPE_17B_16E: return "17Bx16E (Scout)";
203203
case LLM_TYPE_17B_128E: return "17Bx128E (Maverick)";
204204
case LLM_TYPE_A13B: return "A13B";
205+
case LLM_TYPE_7B_A1B: return "7B.A1B";
205206
case LLM_TYPE_8B_A1B: return "8B.A1B";
206207
case LLM_TYPE_21B_A3B: return "21B.A3B";
207208
case LLM_TYPE_30B_A3B: return "30B.A3B";
@@ -1932,8 +1933,10 @@ void llama_model::load_hparams(llama_model_loader & ml) {
19321933

19331934
ml.get_key(LLM_KV_ATTENTION_LAYERNORM_RMS_EPS, hparams.f_norm_rms_eps);
19341935

1935-
switch (hparams.n_layer) {
1936-
// TODO: Add llm type label (not sure this is useful)
1936+
switch (hparams.n_embd) {
1937+
case 1536: type = LLM_TYPE_7B_A1B; break;
1938+
case 2048: case 2560: type = LLM_TYPE_3B; break;
1939+
case 4096: type = LLM_TYPE_32B; break;
19371940
default: type = LLM_TYPE_UNKNOWN;
19381941
}
19391942

src/llama-model.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ enum llm_type {
107107
LLM_TYPE_17B_16E, // llama4 Scout
108108
LLM_TYPE_17B_128E, // llama4 Maverick
109109
LLM_TYPE_A13B,
110+
LLM_TYPE_7B_A1B,
110111
LLM_TYPE_8B_A1B, // lfm2moe
111112
LLM_TYPE_21B_A3B, // Ernie MoE small
112113
LLM_TYPE_30B_A3B,

0 commit comments

Comments
 (0)