-
Notifications
You must be signed in to change notification settings - Fork 682
[XPU] xpu support think length limit #4539
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
Conversation
|
ddchenhao66 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Thanks for your contribution! |
|
|
||
| } | ||
|
|
||
| PD_BUILD_OP(limit_thinking_content_length_v1) |
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.
这里不需要改成 PD_BUILD_STATIC_OP 吗,下同
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.
ok
| max_think_lens = share_inputs["max_think_lens"] | ||
| step_idx = share_inputs["step_idx"] | ||
| limit_think_status = share_inputs["limit_think_status"] | ||
| print(f"ch66 limit_strategy:{limit_strategy}") |
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.
delete print
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.
ok
2576384 to
25ea457
Compare
| else: | ||
| # Disable thinking | ||
| self.share_inputs["max_think_lens"][idx : idx + 1, :] = -1 | ||
| self.share_inputs["limit_think_status"][idx : idx + 1, :] = 0 |
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.
self.share_inputs["limit_think_status"][idx : idx + 1, :] = 0 可以合并一下?
| if request.get("enable_thinking", False) and request.get("reasoning_max_tokens", None) is not None: | ||
| # Enable thinking | ||
| self.share_inputs["max_think_lens"][idx : idx + 1, :] = request.get("reasoning_max_tokens") | ||
| self.share_inputs["limit_think_status"][idx : idx + 1, :] = 0 |
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.
self.share_inputs["limit_think_status"][idx : idx + 1, :] = 0 可以合并一下?
| // 强制将当前token替换为结束思考的token | ||
| next_token_lm = line_break_id; | ||
| limit_think_status_lm = 2; | ||
| } |
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.
这里再加一个else{}? 加一些debug信息?
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.
不需要,else的场景不需要操作
|
|
||
| WRAPPER_DUMP(ctx); | ||
| if (ctx->dev().type() == api::kCPU) { | ||
| assert(false); |
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.
后面有空补上 CPU wrapper 的实现吧
| WRAPPER_DUMP_PARAM2(ctx,line_break_id,bs); | ||
| WRAPPER_DUMP(ctx); | ||
| if (ctx->dev().type() == api::kCPU) { | ||
| assert(false); |
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.
同上
cqulilujia
left a comment
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.
顺手绑一下pybind.cc吧
yuanlehome
left a comment
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.
LGTM
XiaoguangHu01
left a comment
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.
LGTM
25d4408
25d4408 to
31fc218
Compare
hong19860320
left a comment
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.
LGTM
xpu支持限制思考长度,使用kernel提升性能
Motivation
Modifications
Usage or Command
Accuracy Tests
Checklist
[FDConfig],[APIServer],[Engine],[Scheduler],[PD Disaggregation],[Executor],[Graph Optimization],[Speculative Decoding],[RL],[Models],[Quantization],[Loader],[OP],[KVCache],[DataProcessor],[BugFix],[Docs],[CI],[Optimization],[Feature],[Benchmark],[Others],[XPU],[HPU],[GCU],[DCU],[Iluvatar],[Metax]]pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.