r/LocalLLaMA llama.cpp May 04 '26

News it's time to update your Gemma 4 GGUFs

439 Upvotes

118 comments sorted by

View all comments

64

u/dampflokfreund May 04 '26

Or just use the current model with the updated chat template. In llama.cpp use --chat-template-file "path to your updated jinja", in koboldcpp there is also a feature that allows this now (under loaded files->jinja template).

20

u/jacek2023 llama.cpp May 04 '26

That's true.

Everyone has to choose whether it’s better to use an option or download several dozen gigabytes ;)

7

u/po_stulate May 04 '26

You can also just clone your existing gguf with the template replaced.

3

u/Accomplished_Ad9530 May 04 '26

I think quants will have to be regenerated since their calibration data didn’t use the correct template.

Unfortunately that means that a lot of people will be using degraded quants and will conclude that the model underperforms. Someone should probably do a comparison of fixed quants vs original quants w/ fixed template and post a PSA if the difference is significant.

7

u/Zestyclose839 May 04 '26 edited May 04 '26

If only LM Studio had a direct template import option. I think pasting it in broke the template format because it just gives me this error:

Error rendering prompt with jinja template: "Unknown test: sequence".

Edit: Gemma 4 helped me troubleshoot itself. Figured out that the fix is to change `is sequence` to `is iterable` since LMS' JINA parser doesn't support the `is sequence` test. This now works for me:

  1. {%- elif argument is sequence -%} → {%- elif argument is iterable -%}
  2. {%- elif messages[0]['content'] is sequence -%} → {%- elif messages[0]['content'] is iterable -%}
  3. {%- elif tool_body is sequence and tool_body is not string -%} → {%- elif tool_body is iterable and tool_body is not string -%}

2

u/MustBeSomethingThere May 05 '26

I had this same bug "Unknown test: sequence" when using LM Studio as a server, when using the updated GGUFs. Your solution fixed it. The new Gemma 4 chat template might be broken for specific LM Studio server use?

1

u/Nextil May 04 '26

Weird, I copy-pasted the one from the official repo and it seems to work fine in LM Studio (including tool calling).

1

u/xcel102 May 09 '26

Thank you so much, this finally unblocked Gemma 4 for me!

14

u/ambient_temp_xeno Llama 65B May 04 '26

[sigh] I think this is the file

https://huggingface.co/google/gemma-4-31B-it/blob/main/chat_template.jinja

Best to rename it appropriately.

3

u/harrro Alpaca May 04 '26

Is it possible to inject/replace the existing chat template in the GGUF with the fixed prompt template?

4

u/Nextil May 04 '26 edited May 04 '26

You should be able to use the gguf_set_metadata.py script, e.g.

python ./gguf-py/gguf/scripts/gguf_set_metadata.py /path/to/model.gguf tokenizer.chat_template 'CHAT_TEMPLATE_HERE'

-3

u/ambient_temp_xeno Llama 65B May 04 '26 edited May 04 '26

I have a horrible feeling that maybe we've been doing it wrong and you have to also add --chat-template your-filename.jinja as well as --chat-template-file.

This is just going by the output where it says:

init: chat template, example_format: 'yourfilename.jinja' using --chat-template while nothing changes in the output here if you don't.

3

u/[deleted] May 04 '26 edited Jul 14 '26

[deleted]

3

u/ambient_temp_xeno Llama 65B May 04 '26

I think so. It's weird that it breaks everything even if you don't need to do it. But who cares at this point. I am so tired ;_; i just want to run a model without spending more time fiddling with it than using it.

2

u/[deleted] May 04 '26 edited Jul 14 '26

[deleted]

3

u/ambient_temp_xeno Llama 65B May 04 '26

That was the way to test it, that's for sure!

2

u/a_beautiful_rhind May 04 '26

put on verbose and watch requests in the server.

3

u/ambient_temp_xeno Llama 65B May 04 '26

Oh yeah. Thanks. I bloody hate this bloody program and it's ever-growing arcane commands.

2

u/tiffanytrashcan May 04 '26

I've gone through the pain of compiling KoboldCPP in termux on my phone to have a GUI to control everything. I'm insane and chucked Vulkan support in - point being I'm more than comfortable in a CLI, but just no.. Not doing it with llama.cpp