Fix per-request enable_thinking toggle in server#1030
Open
eyupcanakman wants to merge 1 commit intoml-explore:mainfrom
Open
Fix per-request enable_thinking toggle in server#1030eyupcanakman wants to merge 1 commit intoml-explore:mainfrom
eyupcanakman wants to merge 1 commit intoml-explore:mainfrom
Conversation
The chat_template_kwargs from client requests (e.g. enable_thinking) were applied to the chat template during tokenization but ignored when building the GenerationContext. This meant the response handler always used the static tokenizer.has_thinking flag, so reasoning detection and prompt checkpointing could not be toggled per request. Add _has_thinking() that resolves the effective thinking state from per-request kwargs, CLI --chat-template-args, then the tokenizer default. Use it in both generation paths and prompt checkpointing. Fixes ml-explore#914
|
The priority chain (per-request kwargs > CLI args > tokenizer default) is the right design and fixes a real bug — setting Heads up: this conflicts with PR #1006 which also modifies |
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.
fixes #914.
PR #829 added chat_template_kwargs support so clients can send enable_thinking per request, but has_thinking was still read from the static tokenizer property. The per-request value was applied to the chat template but ignored during response handling.
Added _has_thinking() that checks per-request kwargs first, then CLI --chat-template-args, then falls back to tokenizer.has_thinking. Both batch and single generation paths use it.