class_docstr: Support the CLIP model.
  Refer to https://huggingface.co/docs/transformers/model_doc/clip
class_docstr_tok: ["Support","the","CLIP","model",".","Refer","to","https",":","\/\/huggingface.co\/docs\/transformers\/model_doc\/clip"]
docstr: Assign an id to each layer. Layer ids will be used in layer-wise lr decay.
  Basically, id gradually increases when going from the output end to
  the input end. The layers defined in this class, e.g., head, have id 0.
  
  Returns
  -------
  A dictionary mapping the layer names (keys) to their ids (values).
docstr_tok: ["Assign","an","id","to","each","layer",".","Layer","ids","will","be","used","in","layer-wise","lr","decay",".","Basically",",","id","gradually","increases","when","going","from","the","output","end","to","the","input","end",".","The","layers","defined","in","this","class",",","e.g.",",","head",",","have","id","0",".","Returns","--","--","--","-","A","dictionary","mapping","the","layer","names","(","keys",")","to","their","ids","(","values",")","."]
code: def get_layer_ids(
      self,
  ):
      """
      Assign an id to each layer. Layer ids will be used in layer-wise lr decay.
      Basically, id gradually increases when going from the output end to
      the input end. The layers defined in this class, e.g., head, have id 0.
  
      Returns
      -------
      A dictionary mapping the layer names (keys) to their ids (values).
      """
      model_prefixes = [
          "model.text_model",
          "model.vision_model",
          "model",
      ]
      # later model prefixes can't starts with the early ones
      for i, model_pre in enumerate(model_prefixes):
          for model_pre2 in model_prefixes[i + 1 :]:
              if model_pre2.startswith(model_pre):
                  raise ValueError(
                      f"{model_pre} is a substring of {model_pre2}. Need to swap them in {model_prefixes}."
                  )
  
      pre_encoder_patterns = ("embeddings", "pre")
      post_encoder_patterns = (
          "head",
          "final",
          "post",
          "logit",
          "project",
      )
      names = [n for n, _ in self.named_parameters()]
  
      name_to_id = {}
      for per_prefix in model_prefixes:
          per_model_name_to_id, names = assign_layer_ids(
              names=names,
              pre_encoder_patterns=pre_encoder_patterns,
              post_encoder_patterns=post_encoder_patterns,
              model_pre=per_prefix,
          )
          name_to_id.update(per_model_name_to_id)
  
      if len(names) > 0:
          logger.debug(f"outer layers are treated as head: {names}")
      for n in names:
          assert n not in name_to_id
          name_to_id[n] = 0
  
      return name_to_id
  
file_path: autogluon/multimodal/src/autogluon/multimodal/models/clip.py
imports: import logging
  from typing import Optional
  import torch
  from torch import nn
  from ..constants import AUTOMM, COLUMN, COLUMN_FEATURES, FEATURES, IMAGE, IMAGE_VALID_NUM, LABEL, LOGIT_SCALE, LOGITS, MASKS, TEXT_TOKEN_IDS, TEXT_VALID_LENGTH
  from .utils import assign_layer_ids, get_column_features, get_hf_config_and_model, get_pretrained_tokenizer, init_weights
label_desc: Use image node_id 12 for calling the CLIPForImageText obj's underlying member method code with example usage: obj.get_layer_ids() and returns: name_to_id