Skip to content

Commit fcc7508

Browse files
authored
model : Gemma4 model type detection (ggml-org#22027)
* model : Gemma4 model type detection * model : Gemma4 model type detection
1 parent 5e6c0e1 commit fcc7508

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/llama-model.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ const char * llm_type_name(llm_type type) {
432432
case LLM_TYPE_26B: return "26B";
433433
case LLM_TYPE_27B: return "27B";
434434
case LLM_TYPE_30B: return "30B";
435+
case LLM_TYPE_31B: return "31B";
435436
case LLM_TYPE_32B: return "32B";
436437
case LLM_TYPE_34B: return "34B";
437438
case LLM_TYPE_35B: return "35B";
@@ -466,6 +467,7 @@ const char * llm_type_name(llm_type type) {
466467
case LLM_TYPE_16B_A1B: return "16B.A1B";
467468
case LLM_TYPE_21B_A3B: return "21B.A3B";
468469
case LLM_TYPE_24B_A2B: return "24B.A2B";
470+
case LLM_TYPE_26B_A4B: return "26B.A4B";
469471
case LLM_TYPE_30B_A3B: return "30B.A3B";
470472
case LLM_TYPE_31B_A3_5B: return "31B.A3.5B";
471473
case LLM_TYPE_35B_A3B: return "35B.A3B";
@@ -1624,8 +1626,10 @@ void llama_model::load_hparams(llama_model_loader & ml) {
16241626
ml.get_key(LLM_KV_FINAL_LOGIT_SOFTCAPPING, hparams.f_final_logit_softcapping, false);
16251627

16261628
switch (hparams.n_layer) {
1629+
case 30: type = LLM_TYPE_26B_A4B; break;
16271630
case 35: type = LLM_TYPE_E2B; break;
1628-
case 42: type = LLM_TYPE_E4B; break; // to confirm: E4B or E5B?
1631+
case 42: type = LLM_TYPE_E4B; break;
1632+
case 60: type = LLM_TYPE_31B; break;
16291633
default: type = LLM_TYPE_UNKNOWN;
16301634
}
16311635
} break;

src/llama-model.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ enum llm_type {
8484
LLM_TYPE_26B,
8585
LLM_TYPE_27B,
8686
LLM_TYPE_30B,
87+
LLM_TYPE_31B,
8788
LLM_TYPE_32B,
8889
LLM_TYPE_34B,
8990
LLM_TYPE_35B,
@@ -118,6 +119,7 @@ enum llm_type {
118119
LLM_TYPE_16B_A1B,
119120
LLM_TYPE_21B_A3B, // Ernie MoE small
120121
LLM_TYPE_24B_A2B, // lfm2moe
122+
LLM_TYPE_26B_A4B, // Gemma4
121123
LLM_TYPE_30B_A3B,
122124
LLM_TYPE_31B_A3_5B,
123125
LLM_TYPE_35B_A3B, // Qwen3.5

0 commit comments

Comments
 (0)