DataParallelStrategy
- class lightning.fabric.strategies.DataParallelStrategy(accelerator=None, parallel_devices=None, checkpoint_io=None, precision=None)
Bases:
ParallelStrategyImplements data-parallel training in a single process, i.e., the model gets replicated to each device and each gets a split of the data.
- all_reduce(collection, group=None, reduce_op='mean')
Reduces the given tensor (e.g. across GPUs/processes).
- barrier(*args, **kwargs)
Synchronizes all processes which blocks processes until the whole group enters this function.
- Parameters:
name – an optional name to pass into barrier.
- Return type:
- batch_to_device(batch, device=None)
Moves the batch to the correct device.
The returned batch is of the same type as the input batch, just having all tensors on the correct device.
- broadcast(obj, src=0)
Broadcasts an object to all processes.
- load_module_state_dict(module, state_dict, strict=True)
Loads the given state into the model.
- Return type:
- module_to_device(module)
Moves the model to the correct device.
- Return type:
- reduce_boolean_decision(decision, all=True)
Reduces a boolean decision over distributed processes. By default is analogous to
allfrom the standard library, returningTrueonly if all input decisions evaluate toTrue. Ifallis set toFalse, it behaves likeanyinstead.
- setup_module(module)
Wraps the given model into a
DataParallelmodule.- Return type:
- property distributed_sampler_kwargs: None
Arguments for the
DistributedSampler.If this method is not defined, or it returns
None, then theDistributedSamplerwill not be used.
- property root_device: device
Returns the root device.
Was this page helpful?
Thanks for the feedback.