code: def make_deepspeed_mpu(
      topology: topology.PipelineParallelGrid,
  ) -> ModelParallelUnit:
      is_first_pipeline_stage = topology.get_pipe_parallel_rank() == 0
      last_stage = topology.get_pipe_parallel_world_size() - 1
      is_last_pipeline_stage = (
          topology.get_pipe_parallel_rank() == last_stage
      )
      should_build_data_loader = (
          topology.get_slice_parallel_rank() == 0
          and (is_first_pipeline_stage or is_last_pipeline_stage)
      )
      return ModelParallelUnit(
          data_parallel_rank=topology.get_data_parallel_rank(),
          data_parallel_world_size=topology.get_data_parallel_world_size(),
          should_report_metrics=True,
          should_build_data_loader=should_build_data_loader,
      )
  
imports: from dataclasses import dataclass
  from deepspeed.runtime.pipe import topology
  from determined import core
label_desc: Use image node_id 2 for calling a global function with example usage: make_deepspeed_mpu(topology) and returns: ModelParallelUnit