[fix][data] Apply chat-template kwargs during filtering - #2006
Open
bvolpato wants to merge 2 commits into
Open
Conversation
This was referenced Aug 10, 2026
Member
|
@bvolpato Thanks! is this ready for review? |
bvolpato
force-pushed
the
bvolpato/prompt-filter-chat-template-kwargs
branch
from
August 13, 2026 01:20
0ccbb47 to
2e72dac
Compare
bvolpato
marked this pull request as ready for review
August 13, 2026 01:23
Contributor
Author
|
yes, ready for review now. I rebased it onto current main, reran the dataset suite and full pre-commit, and updated the PR description. |
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces support for passing custom chat_template_kwargs to the PromptDataset and its prompt filtering helper function, allowing configuration of the tokenizer's chat template application (e.g., enabling thinking tokens). Corresponding tests were added to verify this behavior. The review feedback suggests filtering out conflicting keys (add_generation_prompt, return_dict, tokenize) from chat_template_kwargs to prevent potential TypeErrors and logic breakage.
Preserve explicit tokenizer controls when configured chat template kwargs contain conflicting keys. Reuse merge logic across prompt filtering and non-batched generation.
bvolpato
force-pushed
the
bvolpato/prompt-filter-chat-template-kwargs
branch
from
August 14, 2026 04:39
5572a4a to
23a5d43
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PromptDatasetfiltered examples withoutgenerator.chat_template_kwargs, while generation applied those options later. Settings such asenable_thinkingcan change rendered prompt length, so preprocessing could accept an over-length prompt or reject a valid one.Changes
chat_template_kwargstoPromptDataset.Empty kwargs preserve existing behavior. Dataset records, collated batches, and inference contracts do not change.
Testing
1464 passed, 7 skipped, 5 deselected)9 passed)32 passed)add_generation_prompt,return_dict, andtokenizecontrols (3 passed)pre-commit run --all-filesgit diff --check upstream/main