-
Notifications
You must be signed in to change notification settings - Fork 634
[Feature]add model status #4302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Thanks for your contribution! |
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": |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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, | ||
) | ||
|
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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, | ||
]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果遇到的是 tool_call 的special, 也可以直接返回 none 了
1.Add the
get_model_status
method in thereasoning_parser
to obtain the model's status, and determine how to perform parsing based on the status.2.Remove the judgment of
enable_thinking
.