code: def compute_splits(
      self,
      model,
      partitions,
      idx,
      tp_rank,
      pp_rank,
      pp_split_rank,
      tp_size,
      pp_size,
  ):
      splits = []
  
      # This is the PP X TP Y model with partial parameters present in correct order.
      # We need to extract the parameters from the global map in reverse order to fill in the
      # parameters of this model in forward order.
      for param_name, param in model.named_parameters():
          # Since we are moving forward, we may reach the end of the global map
          # but GPT has an additional word embedding as its last parameter
          # Therefore we check for this, and reset the index to the parameter of the PP 0 TP 0 rank
          # which holds the parameters of the embedding.
          if (
              idx == (len(partitions[0]))
              and self.duplicate_gpt_word_embedding_offset > 0
          ):
              logging.info(
                  "Found duplicate embedding copy for GPT model, resetting index"
              )
              idx = 0  # reset idx parameter to 0 if we have duplicate embedding copy
  
          debug_log_split_param_diff(idx, param, param_name, partitions)
  
          # Tensor Parallel Splitting
          split = compute_tp_splits(
              param_name,
              param,
              partitions,
              idx,
              tp_size,
              pp_size,
              pp_rank,
              pp_split_rank,
              self.megatron_legacy,
              model.cfg,
          )
  
          splits.append(split)
          idx += 1
  
      return idx, splits
  
imports: import os
  import shutil
  import tarfile
  import tempfile
  from argparse import ArgumentParser
  from typing import Dict, List
  import torch
  import torch.nn
  from omegaconf import OmegaConf, open_dict
  from pytorch_lightning import Trainer
  from nemo.collections.nlp.parts.nlp_overrides import NEMO_MEGATRON_MODEL_PARALLEL_APPSTATE_OVERRIDE, GradScaler, MegatronHalfPrecisionPlugin, NLPDDPStrategy, NLPSaveRestoreConnector, PipelineMixedPrecisionPlugin
  from nemo.utils import logging, model_utils
  from nemo.utils.app_state import AppState
label_desc: Use image node_id 3 for calling the GPTHandler obj's underlying member method code with example usage: obj.compute_splits(model, partitions, idx, tp_rank, pp_rank, pp_split_rank, tp_size, pp_size) and returns: idx,  splits