Repository navigation
fix(data): restore the deepseek-r1-distill chat template - #914
Open
yushengsu-thu wants to merge 2 commits into
Open
yushengsu-thu wants to merge 2 commits into
yushengsu-thu wants to merge 2 commits into
Conversation
deepseek-r1-distill was registered with end_of_turn_token=None. Since sgl-project#381 the general parser passes that token straight to re.escape, so building the parser raised TypeError before a single sample was tokenized. Set it to <|end▁of▁sentence|>, which R1-Distill emits after every answer (same as deepseek-v3), and make the parser raise a clear ValueError when a template that needs end_of_turn_token leaves it unset.
yushengsu-thu
requested review from
FrankLeeeee,
shuaills,
sleepcoo and
zyksir
as code owners
October 1, 2026 04:49
Same pattern as the other templates in test_parsers: render the standard conversation with DeepSeek-R1-Distill-Qwen-1.5B and compare input_ids and loss_mask against a saved reference. The mask covers each answer plus its <|end▁of▁sentence|>.
This branch has not been deployed
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.
Motivation
--chat-template deepseek-r1-distillcrashes before any data gets processed:The template was added with
end_of_turn_token=Nonein #281, which worked at the time, but after the parser rewrite in #381 that value goes straight intore.escape. It's the only registered template that hits this.Modifications
end_of_turn_tokento<|end▁of▁sentence|>fordeepseek-r1-distill. R1-Distill closes every answer with it, same asdeepseek-v3.GeneralParsernow raises a readableValueErrorwhen a template that needsend_of_turn_tokenleaves it unset, instead of theTypeErrorabove.test_parsersregression case with the realDeepSeek-R1-Distill-Qwen-1.5Btokenizer, same pattern as the other templates.Note: the
unit-testcheck currently fails in the live server-capture gate before any test runs (runner lostNO_PROXY, see #937); that's unrelated to this change.