class_docstr: Constructs an KOSMOS-2 processor which wraps a KOSMOS-2 image processor and a KOSMOS-2 tokenizer into a single
  processor.
  
  [`Kosmos2Processor`] offers all the functionalities of [`CLIPImageProcessor`] and some functionalities of
  [`XLMRobertaTokenizerFast`]. See the docstring of [`~Kosmos2Processor.__call__`] and [`~Kosmos2Processor.decode`]
  for more information.
  
  Args:
      image_processor (`CLIPImageProcessor`):
          An instance of [`CLIPImageProcessor`]. The image processor is a required input.
      tokenizer (`XLMRobertaTokenizerFast`):
          An instance of ['XLMRobertaTokenizerFast`]. The tokenizer is a required input.
      num_patch_index_tokens (`int`, *optional*, defaults to 1024):
          The number of tokens that represent patch indices.
code: def __init__(
      self, image_processor, tokenizer, num_patch_index_tokens=1024
  ):
      tokenizer.return_token_type_ids = False
  
      self.eod_token = "</doc>"
  
      self.boi_token = "<image>"
      self.eoi_token = "</image>"
  
      self.eoc_token = "</chunk>"
      self.eol_token = "</line>"
  
      self.bop_token = "<phrase>"
      self.eop_token = "</phrase>"
  
      self.boo_token = "<object>"
      self.eoo_token = "</object>"
  
      self.dom_token = "</delimiter_of_multi_objects/>"
  
      self.grd_token = "<grounding>"
  
      self.tag_tokens = [
          self.eod_token,
          self.boi_token,
          self.eoi_token,
          self.eoc_token,
          self.eol_token,
          self.bop_token,
          self.eop_token,
          self.boo_token,
          self.eoo_token,
          self.dom_token,
          self.grd_token,
      ]
  
      self.num_patch_index_tokens = num_patch_index_tokens
      patch_index_tokens = [
          f"<patch_index_{str(x).zfill(4)}>"
          for x in range(self.num_patch_index_tokens)
      ]
  
      tokens_to_add = []
      for token in self.tag_tokens + patch_index_tokens:
          tokens_to_add.append(
              AddedToken(
                  token, lstrip=True, rstrip=False, normalized=False
              )
          )
      tokenizer.add_tokens(tokens_to_add)
  
      super().__init__(image_processor, tokenizer)
  
imports: import copy
  import math
  import re
  from typing import List, Optional, Tuple, Union
  from ...image_processing_utils import BatchFeature
  from ...image_utils import ImageInput, is_batched
  from ...processing_utils import ProcessorMixin
  from ...tokenization_utils import AddedToken
  from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, TextInput, TruncationStrategy
  from ...utils import TensorType
label_desc: Use image node_id 1 to create a new Kosmos2Processor object from inherited base classes: ProcessorMixin with example: obj = Kosmos2Processor(image_processor, tokenizer, num_patch_index_tokens)