Code · architecture · study mode
Python generator that reads FineWeb .bin shards, splits across 8 DDP ranks (each rank sees unique tokens), optionally…
Full explanation below the code →
Python generator that reads FineWeb .bin shards, splits across 8 DDP ranks (each rank sees unique tokens), optionally aligns to BOS boundaries, and yields 4 CUDA tensors per step: inputs, targets, cum_lengths, bigram_inputs.
Why must DDP ranks see different tokens rather than the same tokens shuffled differently?