Skip to content

Commit 3cb5320

Browse files
committed
rebase
Signed-off-by: Ce Gao <cegao@tensorchord.ai>
1 parent ea5967a commit 3cb5320

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

tests/reasoning/test_deepseekr1_reasoning_parser.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,21 +94,25 @@ def deepseek_r1_qwen_tokenizer():
9494
"output": "<think>This is a reasoning section",
9595
"reasoning_content": "This is a reasoning section",
9696
"content": None,
97+
"is_reasoning_end": False,
9798
}
9899
EMPTY = {
99100
"output": "",
100101
"reasoning_content": "",
101102
"content": None,
103+
"is_reasoning_end": False,
102104
}
103105
EMPTY_STREAMING = {
104106
"output": "",
105107
"reasoning_content": None,
106108
"content": None,
109+
"is_reasoning_end": False,
107110
}
108111
NEW_LINE = {
109112
"output": "\n<think>This is a reasoning section</think>\nThis is the rest",
110113
"reasoning_content": "This is a reasoning section",
111114
"content": "\nThis is the rest",
115+
"is_reasoning_end": True,
112116
}
113117
# Streaming cannot handle new lines at the beginning of the output
114118
# because we need to support <think>...</think> and </think>...
@@ -118,6 +122,7 @@ def deepseek_r1_qwen_tokenizer():
118122
"output": "\n<think>This is a reasoning section</think>\nThis is the rest",
119123
"reasoning_content": "\nThis is a reasoning section",
120124
"content": "\nThis is the rest",
125+
"is_reasoning_end": True,
121126
}
122127

123128
TEST_CASES = [

vllm/reasoning/deepseek_r1_reasoning_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def extract_reasoning_content(
152152

153153
# Check if the start token is present in the model output, remove it
154154
# if it is present.
155-
model_output_parts = model_output.partition(self.think_start_token)
155+
model_output_parts = model_output.partition(self.start_token)
156156
model_output = model_output_parts[2] if model_output_parts[
157157
1] else model_output_parts[0]
158158

@@ -163,7 +163,7 @@ def extract_reasoning_content(
163163
return model_output, None
164164
else:
165165
reasoning_content, _, content = model_output.partition(
166-
self.think_end_token)
166+
self.end_token)
167167
# If the end token is not found, return the model output as is.
168168
# It should not happen since we already checked for the presence
169169
# of the end token.

0 commit comments

Comments
 (0)