-
Notifications
You must be signed in to change notification settings - Fork 256
[0.9.1]optmize rope in qwen2 #1782
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: v0.9.1-dev
Are you sure you want to change the base?
Conversation
Signed-off-by: rjg-lyh <1318825571@qq.com>
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
# TODO: Remove the contiguous in the future. | ||
query = query.contiguous().view(query.shape[0], -1) | ||
key = key.contiguous().view(key.shape[0], -1) | ||
torch_npu._npu_rotary_embedding( |
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.
Are you considering using the npu_mrope operator here?
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.
Are you considering using the npu_mrope operator here?
Not sure if npu_mrope performs exactly the same with _npu_rotary_embedding, so I keep this part unchanged.
Signed-off-by: David9857 <985700846@qq.com>
use npu_apply_rotary_pos_emb when head_size is 128 and is noex_style ### What this PR does / why we need it? Optimize rope by extracting index_select from layers into model, which can reduce (layer_num -1) * 2 Gather ops in each prefill/decode stage. ### Does this PR introduce _any_ user-facing change? NA ### How was this patch tested? NA --------- Signed-off-by: David9857 <985700846@qq.com>
What this PR does / why we need it?
Does this PR introduce any user-facing change?
How was this patch tested?