Skip to content

[Auto Parallel] parallel model and parallel optimizer #69443

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

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

FeixLiu
Copy link
Contributor

@FeixLiu FeixLiu commented Nov 18, 2024

PR Category

Auto Parallel

PR Types

New features

Description

Pcard-73145
parallel model and parallel optimizer

  • 在PaddleNLP中,model的初始化最晚要在amp的decorate之前,也就是Trainer.__init__方法之前。因为amp decorate会真正的进行参数的cast等操作。
  • 在PaddleNLP中,optimizer初始化需要传入lr scheduler,并且lr scheduler的配置的某些分支需要通过checkpoint中的resume step来获取。这就导致optimizer的初始化需要在load checkpoint之后。也就是在trainer.train中完成。
  • 这就导致在PaddleNLP目前的框架体系下,model的初始化与optimizer的初始化位置无法统一,所以中层api需要两个接口分别parallelize model与optimizer。
  • 未来如果PaddleNLP进行更新,譬如将optimizer与lr scheduler解耦,将optimizer的初始化提前到Trainer.__init__之中,中层api也无需使用两个接口分别parallelize model与optimizer。

Copy link

paddle-bot bot commented Nov 18, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@FeixLiu FeixLiu force-pushed the paralllelize_model_and_opt branch from b560449 to 92aa5ef Compare November 18, 2024 01:40
Copy link
Contributor

@jeff41404 jeff41404 left a comment

Choose a reason for hiding this comment

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

OK, we can provide a demo in this format, and then see how to optimize it later

@jeff41404 jeff41404 merged commit 4bdc30a into PaddlePaddle:develop Nov 18, 2024
27 of 28 checks passed
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