-
Notifications
You must be signed in to change notification settings - Fork 498
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
Raise error when minibatch is used in SPMD dataloading and per host b… #8205
Conversation
…atch size is not divisble by data mesh
ok let me resolve the merge conflicts |
@jonb377 can you take another look? |
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 Jack!
if sharding and tensor.dim() > 0 and (tensor.size()[0] % | ||
local_runtime_device_count) != 0: | ||
raise RuntimeError( | ||
"When minibatch is configured, batch dimension of the tensor " + |
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.
Maybe clarify the per-host batch size must be divisible...
? These concepts are kind of confusing since we're mapping host-level sharding into device-level and representing it as a global tensor, so there's three different batch dimensions to consider.
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, let me update in a follow up pr.
…atch size is not divisble by data mesh
When
minibatch
is used in sharding spec, each device is loading it own part of the data and reassemble it during the runtime.Imagenine a case the mesh is (4,1) and the batch size we used is 3, each device will see a data like
and runtime will reassemble a incorrect final data.
If
mini batch
is not used it is OK, because each device will seeand we will drop padding at the end.