-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[hybrid] static model parallel dropout support deterministic RandomSeedGenerator #36228
Merged
wangxicoding
merged 9 commits into
PaddlePaddle:develop
from
wangxicoding:static_mp_random_seed
Oct 19, 2021
Merged
[hybrid] static model parallel dropout support deterministic RandomSeedGenerator #36228
wangxicoding
merged 9 commits into
PaddlePaddle:develop
from
wangxicoding:static_mp_random_seed
Oct 19, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thanks for your contribution! |
wangxicoding
changed the title
static model parallel support deterministic RandomSeedGenerator
[hybrid] static model parallel support deterministic RandomSeedGenerator
Oct 12, 2021
wangxicoding
changed the title
[hybrid] static model parallel support deterministic RandomSeedGenerator
[hybrid] static model parallel dropout support deterministic RandomSeedGenerator
Oct 14, 2021
gongweibao
approved these changes
Oct 15, 2021
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.
LGTM
zhiqiu
approved these changes
Oct 19, 2021
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.
LGTM for backward.py
wangxicoding
added a commit
to wangxicoding/Paddle
that referenced
this pull request
Oct 25, 2021
fuyinno4
pushed a commit
that referenced
this pull request
Oct 25, 2021
… RandomSeedGenerator (#36682) * Revert "Add fused_dropout wrapper to ease use. (#36185) (#36640)" This reverts commit 05d7e2f. * [hybrid] seed and dropout op support force-cpu (#35820) * [HIP] fix op not support AMD GPU bug, the flag PADDLE_WITH_ROCM is invalid * [HIP] fix op not support AMD GPU bug, the flag PADDLE_WITH_ROCM is invalid * [HIP] fix op not support AMD GPU bug * [hybrid] seed and dropout op support force-cpu * [hybrid] seed and dropout op support force-cpu * [hybrid] seed and dropout op support force-cpu * [hybrid] seed and dropout op support force-cpu * [hybrid] seed and dropout op support force-cpu * [hybrid] fix seed ci failed issue * add AsExtra for force_cpu of seed op * Add fused_dropout wrapper to ease use. (#36185) * [hybrid] static model parallel dropout support deterministic RandomSeedGenerator (#36228) Co-authored-by: xiayanming <41795079@qq.com> Co-authored-by: Li Min <11663212+limin2021@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
New features
PR changes
APIs
Describe
static model parallel support deterministic RandomSeedGenerator.
如图,在模型并行中,对于
duplicated
变量需要确保dropout op的一致性,需要使用相同的随机种子生成器。而对于distributed
变量为保证随机性,需要使用不同的随机种子生成器(相同种子理论上也可收敛)。目前静态图中不支持在executor运行时切换随机种子生成器,故通过
seed
op来使用固定的随机种子生成器,以seed
op的输出作为dropout
的种子输入,确保dropout在不同卡上的随机性一致。PR中添加了
set_random_seed_generator
来设置随机种子生成器,可通过对应的名称获取。同时由于dropout需要固定随机种子生成器的功能目前只在模型并行中有需求,所以在fleet.meta_parallel.parallel_layers
添加中包含rng_name
即随机种子生成器名称参数的dropout,供模型并行使用。此外,由于在recompute中,需要固定前向和反向重计算前向时dropout的输入种子,在develop中,如果添加了dropout,则在前向中插入seed op保证随机性。由于本PR的dropout已添加了seed op确保了随机性,所以不需要重复插入。
使用方式: