class_docstr: Visual Question Answering pipeline using a `AutoModelForVisualQuestionAnswering`. This pipeline is currently only
  available in PyTorch.
  
  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",".","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 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: H2O/h2o_flexgen/benchmark/third_party/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