]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama : add 18-layer model type for Gemma 3-270m (#15319)
authorDaniel Bevenius <redacted>
Thu, 14 Aug 2025 15:56:26 +0000 (17:56 +0200)
committerGitHub <redacted>
Thu, 14 Aug 2025 15:56:26 +0000 (17:56 +0200)
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
```

src/llama-model.cpp
src/llama-model.h

index 58ca7df707ef3fd0004f336e05dce74e059219f6..23a26f0c64ea6d463f57582cd13c4d835080198b 100644 (file)
@@ -1095,6 +1095,7 @@ void llama_model::load_hparams(llama_model_loader & ml) {
                 ml.get_key(LLM_KV_ATTENTION_LAYERNORM_RMS_EPS, hparams.f_norm_rms_eps);
 
                 switch (hparams.n_layer) {
+                    case 18: type = LLM_TYPE_537M; break;
                     case 26: type = LLM_TYPE_1B; break;
                     case 34: type = LLM_TYPE_4B; break;
                     case 48: type = LLM_TYPE_12B; break;
index 6fcd74d57fdca7115bb3aac98e6e508a8199ab5e..46f7d0480fabe580df5e9bc3df569942b48c4109 100644 (file)
@@ -39,6 +39,7 @@ enum llm_type {
     LLM_TYPE_410M,
     LLM_TYPE_450M,
     LLM_TYPE_475M,
+    LLM_TYPE_537M,
     LLM_TYPE_700M,
     LLM_TYPE_770M,
     LLM_TYPE_780M,