code: def sync_moe_model_param(model: nn.Module):
      """Make sure model parameters are consistent in MoE parallel context.
  
      Args:
          model (:class:`torch.nn.Module`): A pyTorch model on whose parameters you check the consistency.
      """
      param_dict = get_moe_epsize_param_dict(model)
  
      # synchronize the parameters whose dp_group is the whole world
      if 1 in param_dict:
          for param in param_dict[1]:
              dist.broadcast(param, src=0)
  
      for ep_size in param_dict:
          # When ep_size = world_size, communication is not needed
          if ep_size != 1 and ep_size != MOE_MANAGER.world_size:
              for param in param_dict[ep_size]:
                  src_rank = get_dp_group_ranks(param)[0]
                  dist.broadcast(
                      param, src=src_rank, group=get_dp_group(param)
                  )
  
imports: import contextlib
  import os
  from typing import Any, Callable, Dict, List, Optional, Tuple
  import torch
  import torch.distributed
  import torch.nn
  import torch.nn.functional
  from colossalai.moe.manager import MOE_MANAGER
  from colossalai.tensor.moe_tensor.api import get_dp_group, get_dp_group_ranks, get_ep_size, is_moe_tensor
  from colossalai.utils import get_current_device
label_desc: Use image node_id 7 for calling a global function with example usage: sync_moe_model_param(model) without return types