class_docstr: Prepare NER data for the model specified by "prefix".
docstr: Parameters
  ----------
  model
      The NER model.
  max_len
      The max length of the tokenizer.
  entity_map
      The map between tags and tag indexes. e.g., {"PER":2, "LOC":3}.
docstr_tok: ["Parameters","--","--","--","--","--","model","The","NER","model",".","max_len","The","max","length","of","the","tokenizer",".","entity_map","The","map","between","tags","and","tag","indexes",".","e.g.",",","{","``","PER","''",":2",",","``","LOC","''",":3","}","."]
code: def __init__(
      self,
      model: nn.Module,
      max_len: Optional[int] = None,
      entity_map: Optional[DictConfig] = None,
  ):
      """
      Parameters
      ----------
      model
          The NER model.
      max_len
          The max length of the tokenizer.
      entity_map
          The map between tags and tag indexes. e.g., {"PER":2, "LOC":3}.
      """
      self.prefix = model.prefix
      self.text_token_ids_key = model.text_token_ids_key
      self.text_valid_length_key = model.text_valid_length_key
      self.text_segment_ids_key = model.text_segment_ids_key
      self.text_token_word_mapping_key = (
          model.text_token_word_mapping_key
      )
      self.text_word_offsets_key = model.text_word_offsets_key
      self.label_key = model.label_key
  
      self.tokenizer = None
      self.tokenizer_name = model.tokenizer_name
      self.max_len = max_len
      self.entity_map = entity_map
  
      # Disable tokenizer parallelism
      os.environ["TOKENIZERS_PARALLELISM"] = "false"
      if self.prefix == NER_TEXT:
          self.tokenizer = model.tokenizer
  
          if max_len is None or max_len <= 0:
              self.max_len = self.tokenizer.model_max_length
          else:
              if max_len < self.tokenizer.model_max_length:
                  warnings.warn(
                      f"provided max length: {max_len} "
                      f"is smaller than {model.checkpoint_name}'s default: {self.tokenizer.model_max_length}"
                  )
              self.max_len = min(
                  max_len, self.tokenizer.model_max_length
              )
  
          self.tokenizer.model_max_length = self.max_len
  
file_path: autogluon/multimodal/src/autogluon/multimodal/data/process_ner.py
imports: import logging
  import os
  import warnings
  from typing import Any, Dict, List, Optional, Union
  import numpy
  from nptyping import NDArray
  from omegaconf import DictConfig
  from torch import nn
  from ..constants import AUTOMM, NER_ANNOTATION, NER_TEXT, TEXT, TEXT_NER
  from .collator import PadCollator, StackCollator
  from .utils import process_ner_annotations, tokenize_ner_text
label_desc: Use image node_id 1 to create a new NerProcessor object  with example: obj = NerProcessor(model, max_len, entity_map)