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

[Recompute] Support ernie for dygraph recompute. #2849

Merged
merged 6 commits into from
Aug 10, 2022

Conversation

ZHUI
Copy link
Collaborator

@ZHUI ZHUI commented Jul 21, 2022

PR types

Function optimization

PR changes

Others

Description

Support ernie for dygraph recompute.

@ZHUI ZHUI marked this pull request as draft July 21, 2022 12:59
@ZHUI ZHUI requested a review from guoshengCS July 28, 2022 03:47
@ZHUI ZHUI marked this pull request as ready for review August 4, 2022 07:55
@@ -351,6 +351,7 @@ def main():
model_config[
"attention_probs_dropout_prob"] = model_args.attention_probs_dropout_prob
model = model_class(base_class(**model_config))
# model_config["enable_recompute"] = args.use_recompute
Copy link
Collaborator Author

@ZHUI ZHUI Aug 4, 2022

Choose a reason for hiding this comment

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

需要改造 trainer 中 DP 的 fused_allreduce_gradients 方式。
这块后续需要分布式优化一下体验。

else:
loss.backward()

fused_allreduce_gradients(list(model.parameters()), None)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这里 recompute 基于 PyLayer,所以要手动 fused_allreduce_gradients

Copy link
Contributor

@guoshengCS guoshengCS 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 7ce81e1 into PaddlePaddle:develop Aug 10, 2022
@ZHUI ZHUI deleted the support_recompute branch August 10, 2022 07:08
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