You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Gemma4 NPU2 conversions predate Google's July 2026 template fixes — porting notes for a refresh (2 parser shims) #634
Google shipped a canonical chat-template fix wave for Gemma 4 in July (template header: "Fixed tool-calling loops, turn closures, and thinking content-ordering. Published 2026-07-09"; plus a 2026-07-20 response_template addition to tokenizer_config.json). The FastFlowLM/Gemma4-E4B-IT-NPU2 conversion (last modified 2026-04-28) still carries the April template, which has the tool-call-swallowing x-regex (content captured before tool_calls) and the O(n) continuation scan.
We grafted Google's July files into the local model folder and verified they work through flm serve — but two small adjustments were needed for FLM's parsers, which you'd presumably want in the refreshed conversion. Sharing both so the update is a drop-in.
Porting note 1 — Jinja: adjacent string literals
Google's July chat_template.jinja uses Python-style adjacent string literals inside a raise_exception(...) call (one message split across three quoted lines). FLM's template engine rejects it:
Failed to load model: Expected closing parenthesis in call args at row 259, column 29
Fix: join the three literals into a single one-line string. Semantics unchanged; that's the only spot in the file.
Google's July tokenizer_config.json drops bos_token_id and eos_token_id. FLM reads them and fails:
Failed to load model: [json.exception.type_error.302] type must be number, but is null
Fix: carry them over from the previous config (bos_token_id: 2, eos_token_id: [1, 106]).
Verification (with both shims applied)
FLM v0.9.45, Windows 11, Ryzen AI 5 340 (XDNA2), driver 32.0.203.314
Plain chat: normal.
Tool calling: POST /v1/chat/completions with a tools array returns finish_reason: "tool_calls", a well-formed tool_calls entry with JSON arguments, and content: null — no tool-call text bleeding into content, which the April x-regex ordering was prone to.
Ask
A refreshed Gemma4-E4B-IT-NPU2 (and siblings) built against Google's July files, with the two shims above. Weights don't appear to have changed in the July wave, so this may be a metadata-only republish. Happy to test.
I was interested in new templates so I tried applying your workarounds, but it seems like the generation is now really messed up and it ends answering way too early :(
Activity
BoneHorror commentedon Jul 26, 2026
I was interested in new templates so I tried applying your workarounds, but it seems like the generation is now really messed up and it ends answering way too early :(