Skip to content

[Feature] del LingParser and add it to General ThinkingParser - #904

Merged
curnane-lab merged 1 commit into
mainfrom
feature/template
Oct 2, 2026
Merged

curnane-lab merged 1 commit into
mainfrom
feature/template

Conversation

@jiapingW

Copy link
Copy Markdown
Collaborator

Motivation

LingParser differs from ThinkingParser only by explicitly passing enable_thinking=False. This model-specific subclass is unnecessary if the shared
parser 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

  • Make ChatTemplate.enable_thinking optional:
    • None: leave the thinking argument unchanged.
    • False: explicitly disable thinking.
  • Remove LingParser and its dispatch branch; use ThinkingParser for both Ling-3.0 templates.
  • Migrate Kimi-K3 to None to preserve its previous behavior of not passing a thinking flag.
  • Add tests for all three states and argument precedence, and update template registration assertions.

Related Issues

Follow-up to #870.

Accuracy Test

Benchmark & Profiling

Checklist

# 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you confirm whether this change is necessary and whether the Kimi-K3-related tests still pass?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@curnane-lab

Copy link
Copy Markdown
Collaborator

lgtm, avoids maintaining a model-specific parser for a single model, resulting in cleaner abstraction.

@curnane-lab
curnane-lab merged commit 53398a8 into main Oct 2, 2026
6 checks passed
@curnane-lab
curnane-lab deleted the feature/template branch October 2, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants