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 post_process_generation(self, text, cleanup_and_extract=True):
      caption = text.split(self.eoi_token)[-1]
      if cleanup_and_extract:
          return clean_text_and_extract_entities_with_bboxes(caption)
      return caption
  
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 8 for calling the Kosmos2Processor obj's underlying member method code with example usage: obj.post_process_generation(text, cleanup_and_extract) and returns: caption, clean_text_and_extract_entities_with_bboxes