code: def get_layer_id_for_vit(var_name, max_layer_id):
      """Get the layer id to set the different learning rates in ``layer_wise``
      decay_type.
  
      Args:
          var_name (str): The key of the model.
          max_layer_id (int): Maximum layer id.
      Returns:
          int: The id number corresponding to different learning rate in
          ``LayerDecayOptimizerConstructor``.
      """
      if var_name.startswith("backbone"):
          if "patch_embed" in var_name or "pos_embed" in var_name:
              return 0
          elif ".blocks." in var_name:
              layer_id = int(var_name.split(".")[2]) + 1
              return layer_id
          else:
              return max_layer_id + 1
      else:
          return max_layer_id + 1
  
file_path: mmdetection/projects/ViTDet/vitdet/layer_decay_optimizer_constructor.py
imports: import json
  from typing import List
  import torch.nn
  from mmengine.dist import get_dist_info
  from mmengine.logging import MMLogger
  from mmengine.optim import DefaultOptimWrapperConstructor
  from mmdet.registry import OPTIM_WRAPPER_CONSTRUCTORS
label_desc: Use image node_id 1 for calling a global function with example usage: get_layer_id_for_vit(var_name, max_layer_id) and returns: unknown, int, layer_id, unknown