Skip to content

Bump @huggingface/jinja to pick up generation tag whitespace-trim support - #1761

Open
afonsojanu wants to merge 1 commit into
huggingface:mainfrom
afonsojanu:fix/pin-jinja-generation-tag-1724
Open

Bump @huggingface/jinja to pick up generation tag whitespace-trim support#1761
afonsojanu wants to merge 1 commit into
huggingface:mainfrom
afonsojanu:fix/pin-jinja-generation-tag-1724

Conversation

@afonsojanu

Copy link
Copy Markdown

Closes #1724.

The bundled jinja package already gained support for the {%- generation -%} / {%- endgeneration -%} whitespace-trim variants of the transformers-specific generation tag back in 0.5.7, but this package's own lockfile still resolved @huggingface/jinja to 0.5.6, even though the ^0.5.6 range in package.json already permits the newer release. Chat templates using the trimmed form (as some newer models on the hub do, per the issue) failed to parse with Unknown statement type: generation as a result.

Bumped the declared range to ^0.5.9 and refreshed the lockfile to actually pick up the fix that was already published. Added a regression test that renders a template using the trimmed tag form directly against @huggingface/jinja's Template class, so this doesn't silently regress again if the lockfile drifts.

Verified by temporarily reverting just the package.json bump and reinstalling: the new test fails with the exact reported Unknown statement type: generation error against 0.5.6, and passes once the bump and lockfile update are restored and reinstalled.

…port

The bundled jinja package already gained support for the
{%- generation -%} / {%- endgeneration -%} whitespace-trim variants of
the transformers-specific generation tag back in 0.5.7, but this
package's own lockfile still resolved @huggingface/jinja to 0.5.6,
even though the ^0.5.6 range in package.json already permits the
newer release. Chat templates using the trimmed form (as some newer
models on the hub do) failed to parse with "Unknown statement type:
generation" as a result.

Bumping the declared range to ^0.5.9 and refreshing the lockfile picks
up the fix that was already available. Added a regression test that
renders a template using the trimmed tag form directly against
@huggingface/jinja's Template class.

Fixes huggingface#1724
@xenova xenova mentioned this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LFM uses {%- generation -%} found only in newer jinja not used by transformers.js

1 participant