@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / e661b9ee83
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 6, 21:45 UTC

[NemotronH] Small fix reasoning parser (#36635)

Signed-off-by: Roi Koren <roik@nvidia.com>

roikoren755 committed Mar 11, 2026 at 11:44 UTC e661b9ee83d9d3c6c84c4e1acbe7e0280832e7c4
2 files changed +26 -1
tests/reasoning/test_nemotron_v3_reasoning_parser.py
+22
@@ -128,6 +128,28 @@ def test_nemotron_v3_without_thinking_returns_content(
128 assert content == "This is plain content"
129
130
131 +def test_nemotron_v3_force_nonempty_content_returns_content(
132 + tokenizer: FakeNemotronTokenizer,
133 +):
134 + parser_cls = ReasoningParserManager.get_reasoning_parser(parser_name)
135 + parser = parser_cls(tokenizer)
136 + request = ChatCompletionRequest(
137 + model="test-model",
138 + messages=[],
139 + chat_template_kwargs={"force_nonempty_content": True},
140 + )
141 +
142 + reasoning, content = run_reasoning_extraction(
143 + parser,
144 + ["<think>This is plain content"],
145 + request=request,
146 + streaming=False,
147 + )
148 +
149 + assert reasoning is None
150 + assert content == "This is plain content"
151 +
152 +
153 def test_nemotron_v3_with_thinking_keeps_truncated_reasoning(
154 tokenizer: FakeNemotronTokenizer,
155 ):
vllm/reasoning/nemotron_v3_reasoning_parser.py
+4 -1
@@ -24,7 +24,10 @@ class NemotronV3ReasoningParser(DeepSeekR1ReasoningParser):
24
25 if (
26 chat_template_kwargs
27 - and chat_template_kwargs.get("enable_thinking") is False
27 + and (
28 + chat_template_kwargs.get("enable_thinking") is False
29 + or chat_template_kwargs.get("force_nonempty_content") is True
30 + )
31 and final_content is None
32 ):
33 reasoning_content, final_content = final_content, reasoning_content