MCPcopy Create free account
hub / github.com/modelscope/modelscope / init_dist

Function init_dist

modelscope/utils/torch_utils.py:52–62  ·  view source on GitHub ↗
(launcher: str, backend: str = 'nccl', **kwargs)

Source from the content-addressed store, hash-verified

50
51
52def init_dist(launcher: str, backend: str = 'nccl', **kwargs) -> None:
53 if mp.get_start_method(allow_none=True) is None:
54 mp.set_start_method('spawn')
55 if launcher == 'pytorch':
56 _init_dist_pytorch(backend, **kwargs)
57 elif launcher == 'mpi':
58 _init_dist_mpi(backend, **kwargs)
59 elif launcher == 'slurm':
60 _init_dist_slurm(backend, **kwargs)
61 else:
62 raise ValueError(f'Invalid launcher type: {launcher}')
63
64
65def _init_dist_pytorch(backend: str, **kwargs) -> None:

Callers 8

init_distMethod · 0.90
__init__Method · 0.90
__init__Method · 0.90
after_initMethod · 0.90
after_initMethod · 0.90
test_funcFunction · 0.90
__init__Method · 0.85
__init__Method · 0.85

Calls 3

_init_dist_pytorchFunction · 0.85
_init_dist_mpiFunction · 0.85
_init_dist_slurmFunction · 0.85

Tested by 1

test_funcFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…