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.
  
  Example:
  
  ```python
  >>> from transformers import pipeline
  
  >>> document_qa = pipeline(model="impira/layoutlm-document-qa")
  >>> document_qa(
  ...     image="https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png",
  ...     question="What is the invoice number?",
  ... )
  [{'score': 0.425, 'answer': 'us-001', 'start': 16, 'end': 16}]
  ```
  
  Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial)
  
  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",".","Example",":","``","`","python",">",">",">","from","transformers","import","pipeline",">",">",">","document_qa","=","pipeline","(","model=","''","impira\/layoutlm-document-qa","''",")",">",">",">","document_qa","(","...","image=","''","https",":","\/\/huggingface.co\/spaces\/impira\/docquery\/resolve\/2359223c1837a7587402bda0f2643382a6eefeab\/invoice.png","''",",","...","question=","''","What","is","the","invoice","number","?","``",",","...",")","[","{","'score","'",":","0.425",",","'answer","'",":","'us-001","'",",","'start","'",":","16",",","'end","'",":","16","}","]","``","`","Learn","more","about","the","basics","of","using","a","pipeline","in","the","[","pipeline","tutorial","]","(","..","\/pipeline_tutorial",")","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 postprocess_encoder_decoder_single(self, model_outputs, **kwargs):
      sequence = self.tokenizer.batch_decode(
          model_outputs["sequences"]
      )[0]
  
      # TODO: A lot of this logic is specific to Donut and should probably be handled in the tokenizer
      # (see https://github.com/huggingface/transformers/pull/18414/files#r961747408 for more context).
      sequence = sequence.replace(self.tokenizer.eos_token, "").replace(
          self.tokenizer.pad_token, ""
      )
      sequence = re.sub(
          r"<.*?>", "", sequence, count=1
      ).strip()  # remove first task start token
      ret = {
          "answer": None,
      }
  
      answer = re.search(r"<s_answer>(.*)</s_answer>", sequence)
      if answer is not None:
          ret["answer"] = answer.group(1).strip()
      return ret
  
file_path: 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 7 for calling the DocumentQuestionAnsweringPipeline obj's underlying member method code with example usage: obj.postprocess_encoder_decoder_single(model_outputs) and returns: ret