MCPcopy Index your code
hub / github.com/eric-mitchell/direct-preference-optimization / init_distributed

Function init_distributed

utils.py:148–153  ·  view source on GitHub ↗
(rank: int, world_size: int, master_addr: str = 'localhost', port: int = 12355, backend: str = 'nccl')

Source from the content-addressed store, hash-verified

146
147
148def init_distributed(rank: int, world_size: int, master_addr: str = 'localhost', port: int = 12355, backend: str = 'nccl'):
149 print(rank, 'initializing distributed')
150 os.environ["MASTER_ADDR"] = master_addr
151 os.environ["MASTER_PORT"] = str(port)
152 dist.init_process_group(backend, rank=rank, world_size=world_size)
153 torch.cuda.set_device(rank)
154
155
156class TemporarilySeededRandom:

Callers 1

worker_mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected