File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -480,9 +480,9 @@ def test_rank_aware_sampler_second_rank_gets_cached(self):
480480 )
481481
482482 assert sampled1 == sampled2 == [0 , 1 , 2 ]
483- # First rank returns empty consumed (not all ranks have fetched yet)
483+ # First rank already returns consumed indexes
484484 assert consumed1 == [0 , 1 , 2 ]
485- # Last rank returns consumed when all ranks have fetched
485+ # Second rank also sees the same consumed indexes; state is then cleaned up
486486 assert consumed2 == [0 , 1 , 2 ]
487487 # State should be cleaned up
488488 assert sampler ._states == {}
Original file line number Diff line number Diff line change @@ -75,20 +75,22 @@ def sample(
7575 ready samples, all available samples will be returned.
7676 dp_group: The group id of current data parallel group. Used to
7777 identify which DP group this rank belongs to.
78- dp_world_size: Number of ranks in the data parallel group. Used to
78+ dp_world_size: Number of ranks in the data parallelism group. Used to
7979 determine when all ranks have fetched their samples.
8080 world_size: Total number of ranks across all parallelism dimensions.
8181 Used to determine when all ranks have fetched their samples.
8282 *args: Additional positional arguments (ignored).
8383 **kwargs: Additional keyword arguments (ignored).
8484
8585 Returns:
86- List of sampled global indices of length batch_size
86+ List of sampled global indices. The length is
87+ min(batch_size, len(ready_indexes)), and may be smaller than
88+ batch_size if fewer ready samples are available.
8789
88- List of global indices of length batch_size that should be labeled as consumed
89- (will never be retrieved in the future)
90+ List of global indices that should be labeled as consumed
91+ (will never be retrieved by other dp_groups in the future).
9092
91- Raise :
93+ Raises :
9294 RuntimeError: If ``world_size`` is not divisible by ``dp_world_size``.
9395
9496 Note:
You can’t perform that action at this time.
0 commit comments