Skip to content
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

[NPU] ernie-1.0 support npu device #3954

Merged
merged 5 commits into from
Dec 28, 2022
Merged

Conversation

pangyoki
Copy link
Contributor

@pangyoki pangyoki commented Nov 30, 2022

PR types

Others

PR changes

Others

Description

为ernie-1.0模型添加NPU设备支持。

@paddle-bot
Copy link

paddle-bot bot commented Nov 30, 2022

Thanks for your contribution!

@codecov
Copy link

codecov bot commented Dec 20, 2022

Codecov Report

Merging #3954 (5a29eb0) into develop (d390f28) will increase coverage by 3.36%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           develop    #3954      +/-   ##
===========================================
+ Coverage    33.00%   36.36%   +3.36%     
===========================================
  Files          400      419      +19     
  Lines        56414    59184    +2770     
===========================================
+ Hits         18619    21522    +2903     
+ Misses       37795    37662     -133     
Impacted Files Coverage Δ
paddlenlp/__init__.py 19.76% <0.00%> (-10.54%) ⬇️
paddlenlp/trainer/trainer_utils.py 29.58% <0.00%> (-5.24%) ⬇️
paddlenlp/transformers/auto/modeling.py 71.88% <0.00%> (-4.98%) ⬇️
paddlenlp/experimental/ernie_model.py 32.43% <0.00%> (-0.91%) ⬇️
...nlp/ops/faster_transformer/transformer/decoding.py 7.50% <0.00%> (-0.72%) ⬇️
paddlenlp/trainer/trainer.py 11.24% <0.00%> (-0.24%) ⬇️
paddlenlp/transformers/feature_extraction_utils.py 27.02% <0.00%> (-0.19%) ⬇️
paddlenlp/taskflow/knowledge_mining.py 17.33% <0.00%> (-0.06%) ⬇️
paddlenlp/trainer/trainer_compress.py 8.63% <0.00%> (-0.02%) ⬇️
paddlenlp/transformers/model_utils.py 73.10% <0.00%> (-0.01%) ⬇️
... and 59 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@pangyoki pangyoki changed the title [DO NOT MERGE] ernie-1.0 support npu device [NPU] ernie-1.0 support npu device Dec 20, 2022
@ZHUI ZHUI self-requested a review December 28, 2022 07:06
@@ -540,6 +546,7 @@ def do_train(args):
"softmax",
"layer_norm",
"gelu",
"dropout",
Copy link
Collaborator

Choose a reason for hiding this comment

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

额,这个 dropout 有必要吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

可以让dropout npu op中的Cast CANN op从AICPU算子变成AICore算子,提升性能。

@@ -600,7 +607,7 @@ def do_train(args):
else:
optimizer.step()

optimizer.clear_grad()
optimizer.clear_grad(set_to_zero=False)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

在NPU上执行时,设置set_to_zero=False可以提升性能。加了npu设备的判断条件。

Copy link
Collaborator

@ZHUI ZHUI left a comment

Choose a reason for hiding this comment

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

LGTM

@ZHUI ZHUI merged commit 7b0c59d into PaddlePaddle:develop Dec 28, 2022
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.

2 participants