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 15, 23:30 UTC
[Bugfix] deepseek_r1_reasoning_parser put reason content in wrong field in certain edge case (#13097)
LikeSundayLikeRain committed
Feb 13, 2025 at 02:11 UTC
04f50ad9d1e1fd3f2d9594d5dbfd1d51d37bfea0
2 files changed
+6
-6
tests/entrypoints/openai/reasoning_parsers/test_deepseekr1_reasoning_parser.py
+5
-5
@@ -24,10 +24,10 @@ COMPLETE_REASONING = {
24
"reasoning_content": "This is a reasoning section",
25
"content": None,
26
}
27
-NO_REASONING = {
27
+NO_CONTENT = {
28
"output": "This is content",
29
- "reasoning_content": None,
30
- "content": "This is content",
29
+ "reasoning_content": "This is content",
30
+ "content": None,
31
}
32
NO_REASONING_STREAMING = {
33
"output": "This is a reasoning section",
@@ -98,8 +98,8 @@ TEST_CASES = [
98
),
99
pytest.param(
100
False,
101
- NO_REASONING,
102
- id="no_reasoning_token",
101
+ NO_CONTENT,
102
+ id="no_content_token",
103
),
104
pytest.param(
105
True,
vllm/entrypoints/openai/reasoning_parsers/deepseek_r1_reasoning_parser.py
+1
-1
@@ -128,7 +128,7 @@ class DeepSeekR1ReasoningParser(ReasoningParser):
128
# Thus we assume the reasoning content is always at the start.
129
# Ref https://huggingface.co/deepseek-ai/DeepSeek-R1/commit/8a58a132790c9935686eb97f042afa8013451c9f
130
if self.think_end_token not in model_output:
131
- return None, model_output
131
+ return model_output, None
132
else:
133
# Add a start token if it's missing to keep compatibility.
134
if self.think_start_token not in model_output: