peal.data.dataloaders.create_dataloaders_from_datasource

peal.data.dataloaders.create_dataloaders_from_datasource(config, datasource=None, enable_hints=False, test_config=None)[source]

Create the train/val/test dataloaders for a config from a datasource.

Parameters:
  • config (object) – Config with a data (or data_config) section and optionally training, task, predictor (dict with training and task yaml paths, used when no training section exists) and transition_restrictions (its first entry becomes a class restriction on the train and val sets).

  • datasource (str or tuple or list, optional) – A dataset root passed to get_datasets, a tuple of two or three Dataset objects, or a tuple of two or three DataLoader objects returned as-is. Defaults to data_config.dataset_path.

  • enable_hints (bool, optional) – Call enable_hints on the training dataset.

  • test_config (object, optional) – Forwarded to get_datasets for a differently configured test set.

Returns:

(train_dataloader, val_dataloader, test_dataloader); a member is None when its dataset is empty. Training loaders are DataloaderMixer instances when steps_per_epoch is set.

Return type:

tuple

Notes

As a side effect config.data is replaced by the training dataset’s config when that dataset is not multiclass. An unrecognized datasource prints a message and calls quit().