latest (dev)
Copy
Latest development documentation · Updated 2026-10-08
tensorplay.distributed.algorithms.ddp_comm_hooks.ddp_zero_hook API
Functions 2
hook_with_zero_step_interleaved
functionFull reference ↗- tensorplay.distributed.algorithms.ddp_comm_hooks.ddp_zero_hook.hook_with_zero_step_interleaved(hook: Callable[[Any, GradBucket], Any], ddp: DistributedDataParallel, zero: ZeroRedundancyOptimizer, shard_buckets: bool = False) Callable[[Any, GradBucket], Any][source]
Modify
hookto overlap ZeRO’s optimizer step with the DDP backward pass.Once a bucket’s gradients have been computed, the optimizer computation using those gradients launches, yielding an interleaving of all-reduces and broadcasts in the communication stream. Preferred over
hook_with_zero_step()when communication is relatively fast.
hook_with_zero_step
functionFull reference ↗- tensorplay.distributed.algorithms.ddp_comm_hooks.ddp_zero_hook.hook_with_zero_step(hook: Callable[[Any, GradBucket], Any], ddp: DistributedDataParallel, zero: ZeroRedundancyOptimizer, shard_buckets: bool = False) Callable[[Any, GradBucket], Any][source]
Modify
hookto overlap ZeRO’s optimizer step with the DDP backward pass.The optimizer computation follows the backward computation, overlapping with outstanding backward communication. May be preferred over
hook_with_zero_step_interleaved()when communication is relatively slow compared to computation.- Parameters:
hook – the hook to modify.
ddp – the DDP instance to use.
zero – the ZeRO instance to use.
shard_buckets (bool) – if
True, each DDP bucket assignment is partitioned across possibly multiple ranks.
- Raises:
ValueError – if
zerowas constructed withoverlap_with_ddp=False.
Warning
The first two or three training iterations do not perform parameter updates while DDP bucketing information is being collected.
Help improve this page
Found an error, an unclear step, or a missing example?
tensorplay.distributed.algorithms API
Complete API reference for tensorplay.distributed.algorithms, including signatures, parameters, examples and members.
tensorplay.distributed.algorithms.ddp_comm_hooks.default_hooks API
Complete API reference for tensorplay.distributed.algorithms.ddp_comm_hooks.default_hooks, including signatures, parameters, examples and members.

