class_docstr: Document Question Answering pipeline using any `AutoModelForDocumentQuestionAnswering`. The inputs/outputs are
  similar to the (extractive) question answering pipeline; however, the pipeline takes an image (and optional OCR'd
  words/boxes) as input instead of text context.
  
  This document question answering pipeline can currently be loaded from [`pipeline`] using the following task
  identifier: `"document-question-answering"`.
  
  The models that this pipeline can use are models that have been fine-tuned on a document question answering task.
  See the up-to-date list of available models on
  [huggingface.co/models](https://huggingface.co/models?filter=document-question-answering).
class_docstr_tok: ["Document","Question","Answering","pipeline","using","any","`","AutoModelForDocumentQuestionAnswering","`",".","The","inputs\/outputs","are","similar","to","the","(","extractive",")","question","answering","pipeline",";","however",",","the","pipeline","takes","an","image","(","and","optional","OCR'd","words\/boxes",")","as","input","instead","of","text","context",".","This","document","question","answering","pipeline","can","currently","be","loaded","from","[","`","pipeline","`","]","using","the","following","task","identifier",":","`","``","document-question-answering","''","`",".","The","models","that","this","pipeline","can","use","are","models","that","have","been","fine-tuned","on","a","document","question","answering","task",".","See","the","up-to-date","list","of","available","models","on","[","huggingface.co\/models","]","(","https",":","\/\/huggingface.co\/models","?","filter=document-question-answering",")","."]
code: def _forward(self, model_inputs):
      p_mask = model_inputs.pop("p_mask", None)
      word_ids = model_inputs.pop("word_ids", None)
      words = model_inputs.pop("words", None)
      is_last = model_inputs.pop("is_last", False)
  
      if self.model_type == ModelType.VisionEncoderDecoder:
          model_outputs = self.model.generate(**model_inputs)
      else:
          model_outputs = self.model(**model_inputs)
  
      model_outputs = {k: v for (k, v) in model_outputs.items()}
      model_outputs["p_mask"] = p_mask
      model_outputs["word_ids"] = word_ids
      model_outputs["words"] = words
      model_outputs["attention_mask"] = model_inputs.get(
          "attention_mask", None
      )
      model_outputs["is_last"] = is_last
      return model_outputs
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/pipelines/document_question_answering.py
imports: import re
  from typing import List, Optional, Tuple, Union
  import numpy
  from ..utils import ExplicitEnum, add_end_docstrings, is_pytesseract_available, is_torch_available, is_vision_available, logging
  from .base import PIPELINE_INIT_ARGS, ChunkPipeline
  from .question_answering import select_starts_ends
label_desc: Use image node_id 5 for calling the DocumentQuestionAnsweringPipeline obj's underlying member method code with example usage: obj._forward(model_inputs) and returns: model_outputs