code: def allreduce_params(params, coalesce=True, bucket_size_mb=-1):
      """Allreduce parameters.
  
      Args:
          params (list[torch.Parameters]): List of parameters or buffers of a
              model.
          coalesce (bool, optional): Whether allreduce parameters as a whole.
              Defaults to True.
          bucket_size_mb (int, optional): Size of bucket, the unit is MB.
              Defaults to -1.
      """
      _, world_size = get_dist_info()
      if world_size == 1:
          return
      params = [param.data for param in params]
      if coalesce:
          _allreduce_coalesced(params, world_size, bucket_size_mb)
      else:
          for tensor in params:
              dist.all_reduce(tensor.div_(world_size))
  
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 7 for calling a global function with example usage: allreduce_params(params, coalesce, bucket_size_mb) without return types