class_docstr: Constructs a Donut processor which wraps a Donut feature extractor and an XLMRoBERTa tokenizer into a single
  processor.
  
  [`DonutProcessor`] offers all the functionalities of [`DonutFeatureExtractor`] and
  [`XLMRobertaTokenizer`/`XLMRobertaTokenizerFast`]. See the [`~DonutProcessor.__call__`] and
  [`~DonutProcessor.decode`] for more information.
  
  Args:
      feature_extractor ([`DonutFeatureExtractor`]):
          An instance of [`DonutFeatureExtractor`]. The feature extractor is a required input.
      tokenizer ([`XLMRobertaTokenizer`/`XLMRobertaTokenizerFast`]):
          An instance of [`XLMRobertaTokenizer`/`XLMRobertaTokenizerFast`]. The tokenizer is a required input.
docstr: When used in normal mode, this method forwards all its arguments to AutoFeatureExtractor's
  [`~AutoFeatureExtractor.__call__`] and returns its output. If used in the context
  [`~DonutProcessor.as_target_processor`] this method forwards all its arguments to DonutTokenizer's
  [`~DonutTokenizer.__call__`]. Please refer to the doctsring of the above two methods for more information.
code: def __call__(self, *args, **kwargs):
      """
      When used in normal mode, this method forwards all its arguments to AutoFeatureExtractor's
      [`~AutoFeatureExtractor.__call__`] and returns its output. If used in the context
      [`~DonutProcessor.as_target_processor`] this method forwards all its arguments to DonutTokenizer's
      [`~DonutTokenizer.__call__`]. Please refer to the doctsring of the above two methods for more information.
      """
      # For backward compatibility
      if self._in_target_context_manager:
          return self.current_processor(*args, **kwargs)
  
      images = kwargs.pop("images", None)
      text = kwargs.pop("text", None)
      if len(args) > 0:
          images = args[0]
          args = args[1:]
  
      if images is None and text is None:
          raise ValueError(
              "You need to specify either an `images` or `text` input to process."
          )
  
      if images is not None:
          inputs = self.feature_extractor(images, *args, **kwargs)
      if text is not None:
          encodings = self.tokenizer(text, **kwargs)
  
      if text is None:
          return inputs
      elif images is None:
          return encodings
      else:
          inputs["labels"] = encodings["input_ids"]
          return inputs
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/models/donut/processing_donut.py
imports: import re
  import warnings
  from contextlib import contextmanager
  from ...processing_utils import ProcessorMixin
label_desc: Use image node_id 2 for calling the DonutProcessor obj's underlying member method code with example usage: obj.__call__() and returns: self, inputs, encodings, inputs