Add generation markers to the chat template

#2
by qgallouedec HF Staff - opened

Same as https://huggingface.co/allenai/AstaBrief_8B/discussions/3, applied to this checkpoint's template (stock Qwen3).

This PR adds {% generation %} / {% endgeneration %} markers around the assistant output in chat_template.jinja, so return_assistant_tokens_mask=True returns the assistant tokens, as needed for assistant-only loss (e.g. TRL SFT with assistant_only_loss=True). Rendering is unchanged. The mask covers what the model generates, up to and including <|im_end|>.

Looks good, thank you!

aakanksha19 changed pull request status to open
aakanksha19 changed pull request status to merged

Sign up or log in to comment