-
Notifications
You must be signed in to change notification settings - Fork 31.6k
[bugfix] fix flash attention 2 unavailable error on Ascend NPU #39166
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
|
This PR is ready for merge @ArthurZucker @SunMarc, cc @EduardDurech |
|
Thanks, I didn't have a device to test this on but looks like you did it correctly |
|
Looking forward for review @ArthurZucker @SunMarc |
ArthurZucker
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.
Makes sense, I think this deserves to be in the patch!
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
[bugfix] fix flash attention 2 error on Ascend NPU
…ngface#39166) [bugfix] fix flash attention 2 error on Ascend NPU
…ngface#39166) [bugfix] fix flash attention 2 error on Ascend NPU
|
Very good work. Can Flash Attention 3 also be used on the Ascend NPU? |
…ngface#39166) [bugfix] fix flash attention 2 error on Ascend NPU
…ngface#39166) [bugfix] fix flash attention 2 error on Ascend NPU
…ngface#39166) [bugfix] fix flash attention 2 error on Ascend NPU
…ngface#39166) [bugfix] fix flash attention 2 error on Ascend NPU
…ngface#39166) [bugfix] fix flash attention 2 error on Ascend NPU
…ngface#39166) [bugfix] fix flash attention 2 error on Ascend NPU
…ngface#39166) [bugfix] fix flash attention 2 error on Ascend NPU
What does this PR do?
#38972 introduce flash attention 3 into
transformers. However, the modification introduce a bug when using flash attention 2 on Ascend NPU.The core reason is due to function names mismatch:
Functions defined from
transformers.integrations.npu_flash_attention:transformers/src/transformers/modeling_flash_attention_utils.py
Lines 140 to 153 in e8e0c76
Functions actually used:
transformers/src/transformers/modeling_flash_attention_utils.py
Lines 470 to 475 in e8e0c76
This PR is committed for solving this problem, by renaming flash attention 2 related functions (e.g.
npu_flash_attn_func) fromtransformers.integrations.npu_flash_attentionto correct names, which should contain_2_symbol (e.g.flash_attn_2_func)Fixes # (issue)
Not related.
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.