Add generation markers to the chat template

#8
by qgallouedec HF Staff - opened

Wraps each assistant message in {% generation %} markers, so apply_chat_template(..., return_assistant_tokens_mask=True) returns the assistant tokens, which assistant-only loss needs. The rendered text is unchanged (checked on 572 conversations), and the mask covers exactly what each assistant message adds, <|content_model_end_sampling|> included.

qgallouedec changed pull request status to open
aurick changed pull request status to merged

Sign up or log in to comment