code: def tp_parser(model):
      policy_list = []
      module_list = []
      layer_list = []
      gem_list = []
  
      module_list = AutoTP.get_module_list(model)
      assert AutoTP.supported(model), (
          "AutoTP not supported for model. Please use kernel injection since container policy for model exists."
          if AutoTP.kernel_supported(module_list)
          else "AutoTP not supported for model. Please provide policy."
      )
      for module in module_list:
          for key, submodule in module._modules.items():
              if isinstance(submodule, nn.Linear):
                  layer_list = layer_list + ["." + key]
              elif (
                  isinstance(submodule, nn.LayerNorm)
                  or key == "LayerNorm"
                  or key == "layer_norm"
              ):
                  layer_list = layer_list + ["ln"]
              else:
                  layer_list = layer_list + AutoTP.get_layers(
                      key, submodule
                  )
          for i, layer in enumerate(layer_list):
              if layer == "ln":
                  if layer_list[i - 1] != "ln":
                      gem_list = gem_list + [layer_list[i - 1]]
              elif "out_proj" in layer:
                  gem_list = gem_list + [layer]
              elif "o_proj" in layer:
                  gem_list = gem_list + [layer]
              elif "down_proj" in layer:
                  gem_list = gem_list + [layer]
              elif "attention.dense" in layer and "GPTNeoX" in str(
                  model
              ):
                  gem_list = gem_list + [layer]
              elif "self_attention.dense" in layer and "falcon" in str(
                  type(module)
              ):  # this is a hack to get the right linear layer for this model!
                  gem_list = gem_list + [layer]
  
          layer_list = []
          if gem_list != []:
              gem_list = list(set(gem_list))
              policy_list = AutoTP.update_policy_list(
                  policy_list, module, gem_list
              )
              gem_list = []
      assert len(policy_list), (
          "AutoTP not supported for model. Please use kernel injection since container policy for model exists."
          if AutoTP.kernel_supported(module_list)
          else "Not able to determine model policy automatically. Please provide policy."
      )
      return policy_list
  
imports: import re
  from torch import nn
  from .replace_policy import replace_policies
  from typing import Optional
  import torch
  from deepspeed import comm
  from .layers import LinearAllreduce, LinearLayer, LmHeadLinearAllreduce
  from deepspeed.accelerator import get_accelerator
  from .fusedqkv_utils import require_tp_fused_qkvw, prepare_tp_fused_qkvw
  from deepspeed.module_inject.tp_shard import get_shard_size, get_shard_size_list
label_desc: Use image node_id 8 for calling the AutoTP obj's underlying member method code with example usage: obj.tp_parser(model) and returns: policy_list