MCPcopy Create free account
hub / github.com/MultimediaTechLab/YOLO / initialize_distributed

Function initialize_distributed

yolo/utils/model_utils.py:176–184  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

174
175
176def initialize_distributed() -> None:
177 rank = int(os.getenv("RANK", "0"))
178 local_rank = int(os.getenv("LOCAL_RANK", "0"))
179 world_size = int(os.getenv("WORLD_SIZE", "1"))
180
181 torch.cuda.set_device(local_rank)
182 dist.init_process_group(backend="nccl", rank=rank, world_size=world_size)
183 logger.info(f"🔢 Initialized process group; rank: {rank}, size: {world_size}")
184 return local_rank
185
186
187def get_device(device_spec: Union[str, int, List[int]]) -> torch.device:

Callers 1

get_deviceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected