avalanche.benchmarks.utils.data_loader.GroupBalancedInfiniteDataLoader
- class avalanche.benchmarks.utils.data_loader.GroupBalancedInfiniteDataLoader(datasets: Sequence[AvalancheDataset], batch_size=32, distributed_sampling: bool = True, **kwargs)[source]
Data loader that balances data from multiple datasets emitting an infinite stream.
- __init__(datasets: Sequence[AvalancheDataset], batch_size=32, distributed_sampling: bool = True, **kwargs)[source]
Data loader that balances data from multiple datasets emitting an infinite stream.
Mini-batches emitted by this dataloader are created by collating together mini-batches from each group. It may be used to balance data among classes, experiences, tasks, and so on.
- Parameters:
datasets – an instance of AvalancheDataset.
batch_size – the size of the batch to take from each dataset. Please note that, differently from other Avalanche multi dataset loaders, this value is the per-dataset contribution to the final mini-batch, NOT the final mini-batch size. The final mini-batches will be of size len(datasets) * batch_size.
distributed_sampling – If True, apply the PyTorch
DistributedSampler
. Defaults to True. Note: the distributed sampler is not applied if not running a distributed training, even when True is passed.kwargs – data loader arguments used to instantiate the loader for each group separately. See pytorch
DataLoader
.
Methods
__init__
(datasets[, batch_size, ...])Data loader that balances data from multiple datasets emitting an infinite stream.