avalanche.benchmarks.utils.data_loader.TaskBalancedDataLoader
- class avalanche.benchmarks.utils.data_loader.TaskBalancedDataLoader(data: AvalancheDataset, oversample_small_tasks: bool = False, **kwargs)[source]
Task-balanced data loader for Avalanche’s datasets.
- __init__(data: AvalancheDataset, oversample_small_tasks: bool = False, **kwargs)[source]
Task-balanced data loader for Avalanche’s datasets.
The iterator returns a mini-batch balanced across each task, which makes it useful when training in multi-task scenarios whenever data is highly unbalanced.
If oversample_small_tasks == True smaller tasks are oversampled to match the largest task. Otherwise, once the data for a specific task is terminated, that task will not be present in the subsequent mini-batches.
- Parameters
data – an instance of AvalancheDataset.
oversample_small_tasks – whether smaller tasks should be oversampled to match the largest one.
kwargs – data loader arguments used to instantiate the loader for each task separately. See pytorch
DataLoader
.
Methods
__init__
(data[, oversample_small_tasks])Task-balanced data loader for Avalanche's datasets.