get_sampler#
- composer.utils.dist.get_sampler(dataset, *, drop_last=False, shuffle=False)[source]#
Constructs a
DistributedSamplerfor a dataset.The
DistributedSamplerassumes that each rank has a complete copy of the dataset. It ensures that each rank sees a unique shard for each epoch containinglen(dataset) / get_world_size()samples.Note
If the
datasetis already sharded by rank, use aSequentialSamplerorRandomSampler.