Fix node calculation in replication
for World
object
#685
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:
A customer was hitting an issue where the number of nodes was not being calculated correctly in the
replication
function of theWorld
object. This is because we did not properly account and test for cases where the number of TP blocks was not cleanly divisible by the original number of ranks per node. For example, with 37 nodes, 8 GPUs per node, andreplication
of 8, theWorld
object returned by thereplication
function would have 5 nodes and 7 ranks per node, which did not account for the last 2 TP blocks (which in this case, were the last 2 nodes).To address this, we check if the number of TP blocks is divisible by the number of ranks per node, and if it's not, we set the number of nodes to 1. So, using the previous example, we now return a
World
object with 1 node and 37 ranks in the node, corresponding to the 37 TP blocks. Download optimality is still guaranteed with 1 node since canonical nodes will still be partitioned among these 37 ranks of the newWorld
object, ensuring that no node will have to download more samples than intended.I also expanded the test cases to include previously failing cases, since the test runs very fast anyways.
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)