ddp

class aitoolbox.torchtrain.callbacks.ddp.DistributedSamplerSetEpoch(train_sampler, validation_sampler, test_sampler)[source]

Bases: aitoolbox.torchtrain.callbacks.abstract.AbstractCallback

Callback setting epoch index in the DistributedSamplers at the beginning of every epoch

Parameters
  • train_sampler (torch.utils.data.distributed.DistributedSampler or None) – Distributed sampler for train loader

  • validation_sampler (torch.utils.data.distributed.DistributedSampler or None) – Distributed sampler for validation loader

  • test_sampler (torch.utils.data.distributed.DistributedSampler or None) – Distributed sampler for test loader

on_epoch_begin()[source]

Logic executed at the beginning of the epoch

Returns

None

class aitoolbox.torchtrain.callbacks.ddp.InMultiProcessDataLoad(train_loader_build_fn=None, val_loader_build_fn=None, test_loader_build_fn=None)[source]

Bases: aitoolbox.torchtrain.callbacks.abstract.AbstractCallback

Multiprocess in-process data loading logic infuser

Parameters
  • train_loader_build_fn (callable or bool or None) – function specifying the training data reading and train data loader preparation which should be returned from the function. If not provided, the original train data loader in TrainLoop will be kept.

  • val_loader_build_fn (callable or bool or None) – function specifying the validation data reading and validation data loader preparation which should be returned from the function. If not provided, the original validation data loader in TrainLoop will be kept.

  • test_loader_build_fn (callable or bool or None) – function specifying the test data reading and test data loader preparation which should be returned from the function. If not provided, the original test data loader in TrainLoop will be kept.

on_multiprocess_start()[source]

Logic executed after a new multiprocessing process is spawned at the beginning of every child process

Returns

None

build_train_dataloader()[source]
build_val_dataloader()[source]
build_test_dataloader()[source]