Decorator to make all processes in distributed training wait for each local_master to do something.
(local_rank: int)
| 73 | |
| 74 | @contextmanager |
| 75 | def torch_distributed_zero_first(local_rank: int): |
| 76 | """ |
| 77 | Decorator to make all processes in distributed training wait for each local_master to do something. |
| 78 | """ |
| 79 | if local_rank not in [-1, 0]: |
| 80 | torch.distributed.barrier() |
| 81 | yield |
| 82 | if local_rank == 0: |
| 83 | torch.distributed.barrier() |
| 84 | |
| 85 | |
| 86 | class SequentialDistributedSampler(Sampler): |
nothing calls this directly
no outgoing calls
no test coverage detected