Repository navigation
[Feature] del LingParser and add it to General ThinkingParser - #904
Merged
Merged
Conversation
jiapingW
requested review from
FrankLeeeee,
shuaills,
sleepcoo and
zyksir
as code owners
September 28, 2026 02:15
curnane-lab
reviewed
Sep 29, 2026
| # regenerations), so preserve the XTML renderer default without | ||
| # passing an explicit thinking flag. | ||
| self.assertIsNone(t.enable_thinking) | ||
| # The assistant header must end inside the think block: the chat |
Collaborator
There was a problem hiding this comment.
Could you confirm whether this change is necessary and whether the Kimi-K3-related tests still pass?
Collaborator
Author
There was a problem hiding this comment.
Kimi-K3 ignores enable_thinking; the parameter that actually takes effect is thinking. Therefore, changing it to None avoids explicitly passing the argument, allowing the tokenizer's default settings to be used instead.
Collaborator
|
lgtm, avoids maintaining a model-specific parser for a single model, resulting in cleaner abstraction. |
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
LingParserdiffers fromThinkingParseronly by explicitly passingenable_thinking=False. This model-specific subclass is unnecessary if the sharedparser can distinguish between leaving the tokenizer default unchanged and explicitly disabling thinking.
This PR consolidates both parsers while preserving the existing Ling rendering and loss-mask behavior.
Modifications
ChatTemplate.enable_thinkingoptional:None: leave the thinking argument unchanged.False: explicitly disable thinking.LingParserand its dispatch branch; useThinkingParserfor both Ling-3.0 templates.Noneto preserve its previous behavior of not passing a thinking flag.Related Issues
Follow-up to #870.
Accuracy Test
Benchmark & Profiling
Checklist