-
Notifications
You must be signed in to change notification settings - Fork 150
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
Relaxing divisibility constraints on num_canonical_nodes and num_physical_nodes #476
Merged
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
karan6181
reviewed
Oct 20, 2023
8 tasks
karan6181
reviewed
Oct 25, 2023
snarayan21
changed the title
Ncn constraint relaxation
Relaxing divisibility constraints on num_canonical_nodes and num_physical_nodes!
Oct 26, 2023
snarayan21
changed the title
Relaxing divisibility constraints on num_canonical_nodes and num_physical_nodes!
Relaxing divisibility constraints on num_canonical_nodes and num_physical_nodes
Oct 26, 2023
…into ncn_relaxation merging main
…h-streaming into ncn_relaxation merging origin
karan6181
reviewed
Oct 26, 2023
karan6181
approved these changes
Oct 26, 2023
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. Thank You!
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.
Description of changes:
Relaxes constraints on
num_canonical_nodes
being divisible byphysical_nodes
or vice versa, opening up many more numbers of nodes to deterministically train and resume on. This can be enabled by settingpartition_algo='reserved'
in StreamingDataset instantiation, or by settingpartition_algo: reserved
in yamls for each dataset. The only assumptions we make are that:num_canonical_nodes
plays nicely withphysical_nodes
only in the initial run.This
reserved
partition algo also preserves earlier functionality with determinism and should replace theorig
algorithm as the default, sinceorig
functionality is a subset of this partitioning algo (in an upcoming PR).Testing:
orig
partition algorithmnum_canonical_nodes
set to 2 and 64. This would not have been possible earlier, and results are shown below. Some numerical instability on newer clusters is likely responsible for slight deviations.orig
partitioning.How it works:
orig
partition method. Save the initial number of physical nodes in the state.orig
partition is still used if NCN and PN play nicely to preserve all earlier functionality and have nicer downloading for nice numbers of PN.In the worst case, a node during the resumed run will have to do twice as much shard downloads as a node from the initial run. This is because of the way a global batch has to be split across the new number of nodes. When combined with better shuffling algorithms and batching methods, this should be an acceptable tradeoff.
Test with
num_canonical_nodes=2
.Test with
num_canonical_nodes=64
.Test from 1->2 nodes, preserving
orig
partitioning behavior:Test from 2->3->4 nodes, with NCN=2, to test multiple resumptions:
Issue #, if available:
Merge Checklist:
Put an
x
without space in the boxes that apply. If you are unsure about any checklist, please don't hesitate to ask. We are here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
pre-commit
on my change. (check out thepre-commit
section of prerequisites)