peal.data.dataloaders.resolve_num_workers

peal.data.dataloaders.resolve_num_workers(training_config=None)[source]

Worker processes for the loaders get_dataloader builds.

The default stays 0, i.e. the behaviour before 2026-09-25: images are decoded and resized on the training process between GPU steps, which the generator code measured at ~15 % GPU utilisation. Raise it per config (training.num_workers) or globally ($PEAL_NUM_WORKERS); the config wins when it is non-zero. It is not raised by default because a dataset that lazily attaches a CUDA model (calculate_outlier_score) cannot be forked into workers, and that has to be checked per dataset first.

Parameters:

training_config (TrainingConfig, optional) – Read for its num_workers field.

Returns:

Number of worker processes, 0 for in-process loading.

Return type:

int