-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Support CP and CP + DP in dispatch mode dataloader #3863
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Mehant Kammakomati <[email protected]>
Signed-off-by: Mehant Kammakomati <[email protected]>
SunMarc
left a comment
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.
Thanks for updating this ! Left a comment. Just a quick question, are you always using DataLoaderDispatcher ? do DataLoaderShard requires some modifications also to work also ? Also, can you add some tests to check that DataLoaderDispatcher is behaving correctly when cp is used ?
| if "tp" in self.torch_device_mesh.mesh_dim_names: | ||
| raise ValueError("TP + CP combination is not yet supported in dispatch mode.") |
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.
we can't make fsdp + tp work also, so it's fine to not put that since we require cp to be used with fsdp
| # multiplied by number of cp groups (dp degree). | ||
| if self.submesh_cp: | ||
| cp_degree = self.submesh_cp.size() | ||
| dp_degree = self.torch_device_mesh.size() // cp_degree |
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.
self.submesh_dp.size() * self.submesh_fsdp.size() would be better no ?
| for i in range(dp_degree): | ||
| portion = slice( | ||
| i * number_of_samples_per_dp_group, (i + 1) * number_of_samples_per_dp_group | ||
| ) | ||
| dp_batch = self.slice_fn(batch, portion) | ||
| for _ in range(cp_degree): | ||
| batches.append(dp_batch) | ||
| batch = concatenate(batches, dim=0) |
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.
explain a bit mroe what's happening here
What does this PR do?
Extends dispatch mode dataloader for CP and CP + DP usecases.
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@SunMarc