-
Notifications
You must be signed in to change notification settings - Fork 284
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
[FSDP] use all_gather for 10X OSD consolidation speedup #595
Merged
Merged
Changes from 15 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6f58b45
boom boom
sshleifer 7ebe6ae
Merge branch 'master' into dbg-fairseq
sshleifer b75664c
Appears to save mem, cost time. BM running
sshleifer 713cf83
passing
sshleifer 34f077b
boom boom
sshleifer ae01b50
boom boom
sshleifer e77301c
run all gather
sshleifer e2ab23e
Cleaner
sshleifer 07bdff8
tfmr tests broken
sshleifer 7b31b56
Tests passing
sshleifer 6691d00
Merge branch 'master' into all-gather-impl
sshleifer 23e1f2f
Passing, besides mypy
sshleifer 7795854
mypy
sshleifer 3750d30
merge master
sshleifer 5c52536
passing, cleaner
sshleifer b42b129
Smaller delta
sshleifer 93a1ae2
Support --fp16-adam-stats
sshleifer 1b6b8f3
Rm print
sshleifer 004e6ad
cleanup
sshleifer 3884dd9
Cleanup
sshleifer aa00204
nicer docs
sshleifer 9d83935
More fp16adam support
sshleifer c7e6a0b
add test, myle CR
sshleifer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -627,15 +627,18 @@ def __init__(self, group, wrapper_config, checkpoint_act=False, delay_before_fre | |
|
||
# "expert" params are different on each rank | ||
torch.manual_seed(42 + group.rank()) | ||
d_expert = 16 | ||
expert = nn.Linear(d_expert, 4) | ||
d_expert = 23 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make sure we unpad expert params correctly. |
||
d_shared = 12 | ||
expert = nn.Linear(d_expert, d_shared) | ||
|
||
self.num_expert_params = sum([p.numel() for p in expert.parameters()]) | ||
for p in expert.parameters(): | ||
p.expert = True | ||
|
||
# everything else is shared | ||
torch.manual_seed(0) | ||
shared = nn.Linear(4, d_expert) | ||
|
||
shared = nn.Linear(d_shared, d_expert) | ||
|
||
if checkpoint_act: | ||
expert = checkpoint_wrapper(expert) | ||
|
@@ -648,7 +651,7 @@ def __init__(self, group, wrapper_config, checkpoint_act=False, delay_before_fre | |
|
||
shared = FullyShardedDataParallel(shared, group, **wrapper_config) | ||
|
||
self.module = nn.Sequential(nn.Linear(8, 4), shared, expert, nn.Linear(4, 8)) | ||
self.module = nn.Sequential(nn.Linear(8, d_shared), shared, expert, nn.Linear(d_shared, 8)) | ||
|
||
def forward(self, x): | ||
if self.delay_before_free_ms > 0: | ||
|
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.
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.
This is the new
_all_gather
logic