Skip to content

Conversation

luukunn
Copy link
Collaborator

@luukunn luukunn commented Sep 28, 2025

1.Add the get_model_status method in the reasoning_parser to obtain the model's status, and determine how to perform parsing based on the status.
2.Remove the judgment of enable_thinking.

Copy link

paddle-bot bot commented Sep 28, 2025

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Sep 28, 2025
request.set("temperature", 1)
if request.get("top_p") < _SAMPLING_EPS:
request.set("top_p", _SAMPLING_EPS)
if self.reasoning_parser and self.reasoning_parser.__class__.__name__ == "ErnieX1ReasoningParser":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个判断可以去掉了

if request.get("top_p") < _SAMPLING_EPS:
request["top_p"] = _SAMPLING_EPS
if self.reasoning_parser and self.reasoning_parser.__class__.__name__ == "ErnieX1ReasoningParser":
request["enable_thinking"] = True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

if response_dict.outputs.text == "" and response_dict.outputs.reasoning_content == "":
return None
if req_id in self.model_status_dict:
del self.model_status_dict[req_id]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要在上面的 return之前 做del 的判断。

request.enable_thinking = True
if self.reasoning_parser:
model_status = self.reasoning_parser.get_model_status(request.prompt_token_ids)
self.model_status_dict[request.request_id] = model_status
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在 n 参数的场景, request_id = XX_m, 在后处理的 response 中取到的 req_id, 是 XX_m_n, 会造成取不到这个 model_status

enable_thinking=enable_thinking,
**kwargs,
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还有一个 qwen_vl 的processor, 看看是不是需要修改。

reasoning_content = delta_text[:end_index]
content = delta_text[end_index + len(self.think_end_token) :]
return DeltaMessage(reasoning_content=reasoning_content, content=content)
elif self.think_end_token_id in previous_token_ids:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接用 if 就可以,不用 elif。 下面也不需要 else

self.think_end_token_id,
self.response_start_token_id,
self.response_end_token_id,
]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果遇到的是 tool_call 的special, 也可以直接返回 none 了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants