code: def init_dist(launcher, backend="nccl", **kwargs):
      if mp.get_start_method(allow_none=True) is None:
          mp.set_start_method("spawn")
      if launcher == "pytorch":
          _init_dist_pytorch(backend, **kwargs)
      elif launcher == "mpi":
          _init_dist_mpi(backend, **kwargs)
      elif launcher == "slurm":
          _init_dist_slurm(backend, **kwargs)
      else:
          raise ValueError(f"Invalid launcher type: {launcher}")
  
file_path: lavis/lavis/common/annotator/uniformer/mmcv/runner/dist_utils.py
imports: import functools
  import os
  import subprocess
  from collections import OrderedDict
  import torch
  import torch.multiprocessing
  from torch import distributed
  from torch._utils import _flatten_dense_tensors, _take_tensors, _unflatten_dense_tensors
label_desc: Use image node_id 1 for calling a global function with example usage: init_dist(launcher, backend) without return types