(local_rank: int)
| 87 | |
| 88 | @contextmanager |
| 89 | def torch_distributed_zero_first(local_rank: int): |
| 90 | # Decorator to make all processes in distributed training wait for each local_master to do something |
| 91 | if local_rank not in [-1, 0]: |
| 92 | dist.barrier(device_ids=[local_rank]) |
| 93 | yield |
| 94 | if local_rank == 0: |
| 95 | dist.barrier(device_ids=[0]) |
| 96 | |
| 97 | |
| 98 | def device_count(): |
no outgoing calls
no test coverage detected