MCPcopy Create free account
hub / github.com/SwayStar123/SpeedrunDiT / ddp_sync

Function ddp_sync

preprocessing/torch_utils/misc.py:173–179  ·  view source on GitHub ↗
(module, sync)

Source from the content-addressed store, hash-verified

171
172@contextlib.contextmanager
173def ddp_sync(module, sync):
174 assert isinstance(module, torch.nn.Module)
175 if sync or not isinstance(module, torch.nn.parallel.DistributedDataParallel):
176 yield
177 else:
178 with module.no_sync():
179 yield
180
181#----------------------------------------------------------------------------
182# Check DistributedDataParallel consistency across processes.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected