[Misc] Provide a DeepSeek ReasoningParser with thinking enabled by default (#33221)
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
This commit is contained in:
@@ -70,3 +70,19 @@ class DeepSeekV3ReasoningParser(ReasoningParser):
|
||||
current_token_ids,
|
||||
delta_token_ids,
|
||||
)
|
||||
|
||||
|
||||
class DeepSeekV3ReasoningWithThinkingParser(DeepSeekV3ReasoningParser):
|
||||
"""
|
||||
DeepSeekV3ReasoningParser that defaults to thinking mode.
|
||||
"""
|
||||
|
||||
def __init__(self, tokenizer: PreTrainedTokenizerBase, *args, **kwargs):
|
||||
chat_kwargs = kwargs.get("chat_template_kwargs", {}) or {}
|
||||
thinking = chat_kwargs.get("thinking", None)
|
||||
enable_thinking = chat_kwargs.get("enable_thinking", None)
|
||||
if thinking is None and enable_thinking is None:
|
||||
chat_kwargs["thinking"] = True
|
||||
chat_kwargs["enable_thinking"] = True
|
||||
kwargs["chat_template_kwargs"] = chat_kwargs
|
||||
super().__init__(tokenizer, *args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user