peal.data.dataloaders.get_dataloader

peal.data.dataloaders.get_dataloader(dataset, training_config=None, mode='train', task_config=None, batch_size=None, steps_per_epoch=None)[source]

Wrap a PEAL dataset in a DataLoader (and a mixer for training).

Parameters:
  • dataset (PealDataset) – Dataset to load; dataset.task_config is set to task_config and a task_config.class_restriction is enabled on it.

  • training_config (TrainingConfig, optional) – Supplies <mode>_batch_size when batch_size is None and steps_per_epoch for the mixer. Required if batch_size is None.

  • mode (str, optional) – "train" (shuffled) or "val"/"test" (in order).

  • task_config (TaskConfig, optional) – Task config attached to the dataset.

  • batch_size (int, optional) – Explicit batch size overriding the training config.

  • steps_per_epoch (int, optional) – If given (or set on training_config) and mode == "train", the loader is wrapped in a DataloaderMixer.

Returns:

Single-process (num_workers=0) loader.

Return type:

DataLoader or DataloaderMixer