code: def get_model_type(
      model: torch.nn.Module,
  ) -> ModelType:
      """Get `model_type` of `model`.
  
      If ``model`` doesn't have ``model_type`` attribute, return ``ModelType.encoder_or_decoder``.
  
      Args:
          model
      """
      return getattr(
          unwrap_model(model),
          "model_type",
          ModelType.encoder_or_decoder,
      )
  
imports: from typing import Optional, List, Union, Tuple
  import torch
  from torch.nn.parallel import DistributedDataParallel
  from apex.multi_tensor_apply import multi_tensor_applier
  from apex.transformer import parallel_state
  from apex.transformer.enums import ModelType
  from apex.transformer.microbatches import build_num_microbatches_calculator
  from apex.transformer.pipeline_parallel._timers import _Timers
label_desc: Use image node_id 20 for calling a global function with example usage: get_model_type(model) and returns: getattr