class_docstr: Named entity recognition with huggingface backbones. Inherit from HFAutoModelForTextPrediction.
class_docstr_tok: ["Named","entity","recognition","with","huggingface","backbones",".","Inherit","from","HFAutoModelForTextPrediction","."]
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.
  
  In the AutoModel scenario, this function may not always return the correct result.
  Thus, you can use "print(json.dumps(name_to_id, indent=2))" to manually check whether
  the layer ids are reasonable.
  
  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",".","In","the","AutoModel","scenario",",","this","function","may","not","always","return","the","correct","result",".","Thus",",","you","can","use","``","print","(","json.dumps","(","name_to_id",",","indent=2",")",")","''","to","manually","check","whether","the","layer","ids","are","reasonable",".","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.
  
      In the AutoModel scenario, this function may not always return the correct result.
      Thus, you can use "print(json.dumps(name_to_id, indent=2))" to manually check whether
      the layer ids are reasonable.
  
      Returns
      -------
      A dictionary mapping the layer names (keys) to their ids (values).
      """
      model_prefix = "model"
      pre_encoder_patterns = (
          "embeddings",
          "LayerNorm",
          "wte",
          "wpe",
          "shared.weight",
          "encoder.conv.conv",
          "relative_attention_bias",
          "dummy_layer",
          "mask_emb",
          "word_embedding.weight",
      )
      post_encoder_patterns = (
          "head",
          "pooler",
          "ln_f",
          "final_layer_norm",
      )
      names = [n for n, _ in self.named_parameters()]
  
      name_to_id, names = assign_layer_ids(
          names=names,
          pre_encoder_patterns=pre_encoder_patterns,
          post_encoder_patterns=post_encoder_patterns,
          model_pre=model_prefix,
      )
      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/ner_text.py
imports: import logging
  from typing import Dict, List, Optional, Tuple
  import torch
  import torch.nn.functional
  from torch import nn
  from transformers import logging
  from ..constants import AUTOMM, COLUMN, COLUMN_FEATURES, FEATURES, LABEL, LOGITS, MASKS, NER_ANNOTATION, TEXT_SEGMENT_IDS, TEXT_TOKEN_IDS, TEXT_VALID_LENGTH, TOKEN_WORD_MAPPING, WORD_OFFSETS
  from .huggingface_text import HFAutoModelForTextPrediction
  from .utils import assign_layer_ids, get_column_features, get_pretrained_tokenizer
label_desc: Use image node_id 7 for calling the HFAutoModelForNER obj's underlying member method code with example usage: obj.get_layer_ids() and returns: name_to_id