code: def __init__(self, d_model, n_expert, world_size, node_rank):
      super().__init__(d_model, n_expert, world_size, top_k=2)
      self.ne_per_node = nw_per_node * n_expert
      self.ogn_ratio = 0.14
      try:
          self.ogn_ratio = float(
              os.environ["FMOE_TOPO_OUTGOING_FRACTION"]
          )
      except Exception:
          pass
      self.node_rank = node_rank
  
      mask = [1] * world_size * n_expert
      for i in range(n_expert * world_size):
          if i // self.ne_per_node == self.node_rank:
              mask[i] = 0
      self.mask = torch.Tensor(mask).bool()
      self.policy_fn = None
      print("node rank {} mask {}".format(node_rank, mask))
  
file_path: smart-moe/fmoe/gates/faster_gate.py
imports: from .naive_gate import NaiveGate
  import os
  import sys
  import torch
  import torch.nn.functional
  from .utils import limit_by_capacity
  import fmoe_cuda
  from fmoe.functions import count_by_gate
label_desc: Use image node_id 1 to create a new FasterGate object from inherited base classes: NaiveGate with example: obj = FasterGate(d_model, n_expert, world_size, node_rank)