class_docstr: Visual Question Answering pipeline using a `AutoModelForVisualQuestionAnswering`. This pipeline is currently only
  available in PyTorch.
  
  Example:
  
  ```python
  >>> from transformers import pipeline
  
  >>> oracle = pipeline(model="dandelin/vilt-b32-finetuned-vqa")
  >>> image_url = "https://huggingface.co/datasets/Narsil/image_dummy/raw/main/lena.png"
  >>> oracle(question="What is she wearing ?", image=image_url)
  [{'score': 0.948, 'answer': 'hat'}, {'score': 0.009, 'answer': 'fedora'}, {'score': 0.003, 'answer': 'clothes'}, {'score': 0.003, 'answer': 'sun hat'}, {'score': 0.002, 'answer': 'nothing'}]
  
  >>> oracle(question="What is she wearing ?", image=image_url, top_k=1)
  [{'score': 0.948, 'answer': 'hat'}]
  
  >>> oracle(question="Is this a person ?", image=image_url, top_k=1)
  [{'score': 0.993, 'answer': 'yes'}]
  
  >>> oracle(question="Is this a man ?", image=image_url, top_k=1)
  [{'score': 0.996, 'answer': 'no'}]
  ```
  
  Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial)
  
  This visual question answering pipeline can currently be loaded from [`pipeline`] using the following task
  identifiers: `"visual-question-answering", "vqa"`.
  
  The models that this pipeline can use are models that have been fine-tuned on a visual question answering task. See
  the up-to-date list of available models on
  [huggingface.co/models](https://huggingface.co/models?filter=visual-question-answering).
class_docstr_tok: ["Visual","Question","Answering","pipeline","using","a","`","AutoModelForVisualQuestionAnswering","`",".","This","pipeline","is","currently","only","available","in","PyTorch",".","Example",":","``","`","python",">",">",">","from","transformers","import","pipeline",">",">",">","oracle","=","pipeline","(","model=","''","dandelin\/vilt-b32-finetuned-vqa","''",")",">",">",">","image_url","=","``","https",":","\/\/huggingface.co\/datasets\/Narsil\/image_dummy\/raw\/main\/lena.png","''",">",">",">","oracle","(","question=","''","What","is","she","wearing","?","``",",","image=image_url",")","[","{","'score","'",":","0.948",",","'answer","'",":","'hat","'","}",",","{","'score","'",":","0.009",",","'answer","'",":","'fedora","'","}",",","{","'score","'",":","0.003",",","'answer","'",":","'clothes","'","}",",","{","'score","'",":","0.003",",","'answer","'",":","'sun","hat","'","}",",","{","'score","'",":","0.002",",","'answer","'",":","'nothing","'","}","]",">",">",">","oracle","(","question=","''","What","is","she","wearing","?","``",",","image=image_url",",","top_k=1",")","[","{","'score","'",":","0.948",",","'answer","'",":","'hat","'","}","]",">",">",">","oracle","(","question=","''","Is","this","a","person","?","``",",","image=image_url",",","top_k=1",")","[","{","'score","'",":","0.993",",","'answer","'",":","'yes","'","}","]",">",">",">","oracle","(","question=","''","Is","this","a","man","?","``",",","image=image_url",",","top_k=1",")","[","{","'score","'",":","0.996",",","'answer","'",":","'no","'","}","]","``","`","Learn","more","about","the","basics","of","using","a","pipeline","in","the","[","pipeline","tutorial","]","(","..","\/pipeline_tutorial",")","This","visual","question","answering","pipeline","can","currently","be","loaded","from","[","`","pipeline","`","]","using","the","following","task","identifiers",":","`","``","visual-question-answering","''",",","``","vqa","''","`",".","The","models","that","this","pipeline","can","use","are","models","that","have","been","fine-tuned","on","a","visual","question","answering","task",".","See","the","up-to-date","list","of","available","models","on","[","huggingface.co\/models","]","(","https",":","\/\/huggingface.co\/models","?","filter=visual-question-answering",")","."]
code: def postprocess(self, model_outputs, top_k=5):
      if self.model.can_generate():
          return [
              {
                  "answer": self.tokenizer.decode(
                      output_ids, skip_special_tokens=True
                  ).strip()
              }
              for output_ids in model_outputs
          ]
      else:
          if top_k > self.model.config.num_labels:
              top_k = self.model.config.num_labels
  
          if self.framework == "pt":
              probs = model_outputs.logits.sigmoid()[0]
              scores, ids = probs.topk(top_k)
          else:
              raise ValueError(
                  f"Unsupported framework: {self.framework}"
              )
  
          scores = scores.tolist()
          ids = ids.tolist()
          return [
              {
                  "score": score,
                  "answer": self.model.config.id2label[_id],
              }
              for score, _id in zip(scores, ids)
          ]
  
file_path: transformers/src/transformers/pipelines/visual_question_answering.py
imports: from typing import Union
  from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging
  from .base import PIPELINE_INIT_ARGS, Pipeline
label_desc: Use image node_id 6 for calling the VisualQuestionAnsweringPipeline obj's underlying member method code with example usage: obj.postprocess(model_outputs, top_k) and returns: unknown, unknown