Skip to content

Commit 7a0de96

Browse files
authored
llama : add 18-layer model type for Gemma 3-270m (#15319)
This commit adds support for the 18-layer model type in the Gemma3 series, which is the size of the Gemma3-270m model. The motivation for this commit is was the only change required for Gemma3-270m to be converted to GGUF format and used with llama.cpp. Once the model has been converted and uploaded to Huggingface it can be used like this: ```console $ ./build/bin/llama-cli -hf ggml-org/gemma-3-270m-GGUF:Q8_0 ```
1 parent e4e9159 commit 7a0de96

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/llama-model.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,7 @@ void llama_model::load_hparams(llama_model_loader & ml) {
10951095
ml.get_key(LLM_KV_ATTENTION_LAYERNORM_RMS_EPS, hparams.f_norm_rms_eps);
10961096

10971097
switch (hparams.n_layer) {
1098+
case 18: type = LLM_TYPE_537M; break;
10981099
case 26: type = LLM_TYPE_1B; break;
10991100
case 34: type = LLM_TYPE_4B; break;
11001101
case 48: type = LLM_TYPE_12B; break;

src/llama-model.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ enum llm_type {
3939
LLM_TYPE_410M,
4040
LLM_TYPE_450M,
4141
LLM_TYPE_475M,
42+
LLM_TYPE_537M,
4243
LLM_TYPE_700M,
4344
LLM_TYPE_770M,
4445
LLM_TYPE_780M,

0 commit comments

Comments
 (0)