Skip to content

[NPU]Custom fusion operator unification#8431

Merged
wawltor merged 34 commits into
PaddlePaddle:developfrom
Galaxy1458:develop
May 14, 2024
Merged

[NPU]Custom fusion operator unification#8431
wawltor merged 34 commits into
PaddlePaddle:developfrom
Galaxy1458:develop

Conversation

@Galaxy1458
Copy link
Copy Markdown
Contributor

@Galaxy1458 Galaxy1458 commented May 13, 2024

PR types

Others

PR changes

Models

Description

Custom fusion operator unification

@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented May 13, 2024

Thanks for your contribution!

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2024

Codecov Report

Attention: Patch coverage is 23.52941% with 65 lines in your changes are missing coverage. Please review.

Project coverage is 55.42%. Comparing base (17fb497) to head (0a6d6b8).
Report is 1 commits behind head on develop.

Files Patch % Lines
paddlenlp/transformers/llama/fusion_ops.py 22.50% 62 Missing ⚠️
paddlenlp/transformers/llama/modeling.py 40.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8431      +/-   ##
===========================================
- Coverage    55.43%   55.42%   -0.01%     
===========================================
  Files          616      617       +1     
  Lines        96243    96281      +38     
===========================================
+ Hits         53348    53366      +18     
- Misses       42895    42915      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Galaxy1458 Galaxy1458 changed the title fix [NPU]Custom fusion operator unification May 13, 2024
Copy link
Copy Markdown
Contributor

@SylarTiaNII SylarTiaNII left a comment

Choose a reason for hiding this comment

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

LGTM

wawltor
wawltor previously approved these changes May 14, 2024
Copy link
Copy Markdown
Contributor

@wawltor wawltor left a comment

Choose a reason for hiding this comment

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

LGTM

flash_attention = None


def fusion_rope(query_states, key_states, value_states, hidden_states, position_ids, past_key_value, rotary_emb):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fusion_rope、fusion_flash_attention这种太长了就不建议去抽取了

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已经将paddlenlp/transformers/fusion_ops.py 移动到paddlenlp/transformers/llama/fusion_ops.py


for lib in os.listdir(os.getenv("CUSTOM_DEVICE_ROOT")):
if lib.endswith(".so"):
paddle.utils.cpp_extension.extension_utils.load_op_meta_info_and_register_op(lib)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

注意看是不是有不需要的代码,注意删除掉。

@wawltor wawltor merged commit 05acad5 into PaddlePaddle:develop May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants