code: def patch_model_provider(model_provider):
      from megatron import get_args
  
      def fmoefied_model_provider():
          from .layers import fmoefy
  
          args = get_args()
          return fmoefy(
              model_provider(),
              num_experts=args.num_experts,
              hidden_hidden_size=4 * args.hidden_size // args.top_k,
              top_k=args.top_k,
          )
  
      return fmoefied_model_provider
  
file_path: thu-pacman-faster-moe/fmoe/megatron/balance.py
imports: import torch
  from fmoe.balance import reset_balance_profile
  from fmoe.balance import update_balance_profile
  from fmoe.utils import get_torch_default_comm
  from .distributed import get_moe_group
label_desc: Use image node_id 6 for calling a global function with example usage: patch_model_provider(model_provider) and returns: fmoefied_model_provider, fmoefy