Repository navigation
Leave out a stream that cannot fill one batch instead of failing the epoch - #58
Merged
Merged
Conversation
…vice_per_stream batching, with a warning, instead of failing the epoch.
This file contains hidden or 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
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.
Under
per_streamanddevice_per_streambatching, a stream that cannot fill a single batch raisedValueError, although the message itself said "Training will occur without any samples from this stream". The whole epoch failed because of one small stream.Since #57, a stream with fewer samples than
num_canonical_nodesno longer fails in the shuffle, but it then reached this check. With the defaultnum_canonical_nodes(the number of nodes), such a stream puts one sample on each node. That fills a device batch only when the batch size is 1, so on more than one rank or with larger batches the epoch still failed. For example, a 1-sample stream next to two large ones, on 2 nodes × 2 ranks with batch size 4, or 2 nodes × 8 ranks with batch size 16.This change:
per_stream: a stream that cannot fill one complete global batch is left out of the epoch, with a warning.device_per_stream: a stream that cannot fill one device batch on a node is left out on that node, with a warning. Nodes with different batch counts are already padded to the same count, as before.device_per_stream), the epoch fails with an error that says so.Tests:
test_stream_too_small_for_a_batch_is_skippedruns for both methods on 2 nodes × 2 ranks with batch size 4, with streams of 400, 300 and 1 samples. It checks for the warning and that the 1-sample stream does not appear. It also checks that the other two streams do appear, and that every device batch still comes from a single stream.test_no_stream_fills_a_batchchecks the new error.main. The existing batching tests pass.