class_docstr: Table Question Answering pipeline using a `ModelForTableQuestionAnswering`. This pipeline is only available in
  PyTorch.
  
  This tabular question answering pipeline can currently be loaded from [`pipeline`] using the following task
  identifier: `"table-question-answering"`.
  
  The models that this pipeline can use are models that have been fine-tuned on a tabular question answering task.
  See the up-to-date list of available models on
  [huggingface.co/models](https://huggingface.co/models?filter=table-question-answering).
class_docstr_tok: ["Table","Question","Answering","pipeline","using","a","`","ModelForTableQuestionAnswering","`",".","This","pipeline","is","only","available","in","PyTorch",".","This","tabular","question","answering","pipeline","can","currently","be","loaded","from","[","`","pipeline","`","]","using","the","following","task","identifier",":","`","``","table-question-answering","''","`",".","The","models","that","this","pipeline","can","use","are","models","that","have","been","fine-tuned","on","a","tabular","question","answering","task",".","See","the","up-to-date","list","of","available","models","on","[","huggingface.co\/models","]","(","https",":","\/\/huggingface.co\/models","?","filter=table-question-answering",")","."]
docstr: Answers queries according to a table. The pipeline accepts several types of inputs which are detailed below:
  
  - `pipeline(table, query)`
  - `pipeline(table, [query])`
  - `pipeline(table=table, query=query)`
  - `pipeline(table=table, query=[query])`
  - `pipeline({"table": table, "query": query})`
  - `pipeline({"table": table, "query": [query]})`
  - `pipeline([{"table": table, "query": query}, {"table": table, "query": query}])`
  
  The `table` argument should be a dict or a DataFrame built from that dict, containing the whole table:
  
  Example:
  
  ```python
  data = {
      "actors": ["brad pitt", "leonardo di caprio", "george clooney"],
      "age": ["56", "45", "59"],
      "number of movies": ["87", "53", "69"],
      "date of birth": ["7 february 1967", "10 june 1996", "28 november 1967"],
  }
  ```
  
  This dictionary can be passed in as such, or can be converted to a pandas DataFrame:
  
  Example:
  
  ```python
  import pandas as pd
  
  table = pd.DataFrame.from_dict(data)
  ```
  
  Args:
      table (`pd.DataFrame` or `Dict`):
          Pandas DataFrame or dictionary that will be converted to a DataFrame containing all the table values.
          See above for an example of dictionary.
      query (`str` or `List[str]`):
          Query or list of queries that will be sent to the model alongside the table.
      sequential (`bool`, *optional*, defaults to `False`):
          Whether to do inference sequentially or as a batch. Batching is faster, but models like SQA require the
          inference to be done sequentially to extract relations within sequences, given their conversational
          nature.
      padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `False`):
          Activates and controls padding. Accepts the following values:
  
          - `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single
            sequence if provided).
          - `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum
            acceptable input length for the model if that argument is not provided.
          - `False` or `'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different
            lengths).
  
      truncation (`bool`, `str` or [`TapasTruncationStrategy`], *optional*, defaults to `False`):
          Activates and controls truncation. Accepts the following values:
  
          - `True` or `'drop_rows_to_fit'`: Truncate to a maximum length specified with the argument `max_length`
            or to the maximum acceptable input length for the model if that argument is not provided. This will
            truncate row by row, removing rows from the table.
          - `False` or `'do_not_truncate'` (default): No truncation (i.e., can output batch with sequence lengths
            greater than the model maximum admissible input size).
  
  
  Return:
      A dictionary or a list of dictionaries containing results: Each result is a dictionary with the following
      keys:
  
      - **answer** (`str`) -- The answer of the query given the table. If there is an aggregator, the answer will
        be preceded by `AGGREGATOR >`.
      - **coordinates** (`List[Tuple[int, int]]`) -- Coordinates of the cells of the answers.
      - **cells** (`List[str]`) -- List of strings made up of the answer cell values.
      - **aggregator** (`str`) -- If the model has an aggregator, this returns the aggregator.
docstr_tok: ["Answers","queries","according","to","a","table",".","The","pipeline","accepts","several","types","of","inputs","which","are","detailed","below",":","-","`","pipeline","(","table",",","query",")","`","-","`","pipeline","(","table",",","[","query","]",")","`","-","`","pipeline","(","table=table",",","query=query",")","`","-","`","pipeline","(","table=table",",","query=","[","query","]",")","`","-","`","pipeline","(","{","``","table","''",":","table",",","``","query","''",":","query","}",")","`","-","`","pipeline","(","{","``","table","''",":","table",",","``","query","''",":","[","query","]","}",")","`","-","`","pipeline","(","[","{","``","table","''",":","table",",","``","query","''",":","query","}",",","{","``","table","''",":","table",",","``","query","''",":","query","}","]",")","`","The","`","table","`","argument","should","be","a","dict","or","a","DataFrame","built","from","that","dict",",","containing","the","whole","table",":","Example",":","``","`","python","data","=","{","``","actors","''",":","[","``","brad","pitt","''",",","``","leonardo","di","caprio","''",",","``","george","clooney","''","]",",","``","age","''",":","[","``","56","''",",","``","45","''",",","``","59","''","]",",","``","number","of","movies","''",":","[","``","87","''",",","``","53","''",",","``","69","''","]",",","``","date","of","birth","''",":","[","``","7","february","1967","''",",","``","10","june","1996","''",",","``","28","november","1967","''","]",",","}","``","`","This","dictionary","can","be","passed","in","as","such",",","or","can","be","converted","to","a","pandas","DataFrame",":","Example",":","``","`","python","import","pandas","as","pd","table","=","pd.DataFrame.from_dict","(","data",")","``","`","Args",":","table","(","`","pd.DataFrame","`","or","`","Dict","`",")",":","Pandas","DataFrame","or","dictionary","that","will","be","converted","to","a","DataFrame","containing","all","the","table","values",".","See","above","for","an","example","of","dictionary",".","query","(","`","str","`","or","`","List","[","str","]","`",")",":","Query","or","list","of","queries","that","will","be","sent","to","the","model","alongside","the","table",".","sequential","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","to","do","inference","sequentially","or","as","a","batch",".","Batching","is","faster",",","but","models","like","SQA","require","the","inference","to","be","done","sequentially","to","extract","relations","within","sequences",",","given","their","conversational","nature",".","padding","(","`","bool","`",",","`","str","`","or","[","`","~utils.PaddingStrategy","`","]",",","*","optional","*",",","defaults","to","`","False","`",")",":","Activates","and","controls","padding",".","Accepts","the","following","values",":","-","`","True","`","or","`","'longest","'","`",":","Pad","to","the","longest","sequence","in","the","batch","(","or","no","padding","if","only","a","single","sequence","if","provided",")",".","-","`","'max_length","'","`",":","Pad","to","a","maximum","length","specified","with","the","argument","`","max_length","`","or","to","the","maximum","acceptable","input","length","for","the","model","if","that","argument","is","not","provided",".","-","`","False","`","or","`","'do_not_pad","'","`","(","default",")",":","No","padding","(","i.e.",",","can","output","a","batch","with","sequences","of","different","lengths",")",".","truncation","(","`","bool","`",",","`","str","`","or","[","`","TapasTruncationStrategy","`","]",",","*","optional","*",",","defaults","to","`","False","`",")",":","Activates","and","controls","truncation",".","Accepts","the","following","values",":","-","`","True","`","or","`","'drop_rows_to_fit","'","`",":","Truncate","to","a","maximum","length","specified","with","the","argument","`","max_length","`","or","to","the","maximum","acceptable","input","length","for","the","model","if","that","argument","is","not","provided",".","This","will","truncate","row","by","row",",","removing","rows","from","the","table",".","-","`","False","`","or","`","'do_not_truncate","'","`","(","default",")",":","No","truncation","(","i.e.",",","can","output","batch","with","sequence","lengths","greater","than","the","model","maximum","admissible","input","size",")",".","Return",":","A","dictionary","or","a","list","of","dictionaries","containing","results",":","Each","result","is","a","dictionary","with","the","following","keys",":","-","*","*","answer","*","*","(","`","str","`",")","--","The","answer","of","the","query","given","the","table",".","If","there","is","an","aggregator",",","the","answer","will","be","preceded","by","`","AGGREGATOR",">","`",".","-","*","*","coordinates","*","*","(","`","List","[","Tuple","[","int",",","int","]","]","`",")","--","Coordinates","of","the","cells","of","the","answers",".","-","*","*","cells","*","*","(","`","List","[","str","]","`",")","--","List","of","strings","made","up","of","the","answer","cell","values",".","-","*","*","aggregator","*","*","(","`","str","`",")","--","If","the","model","has","an","aggregator",",","this","returns","the","aggregator","."]
code: def __call__(self, *args, **kwargs):
      r"""
      Answers queries according to a table. The pipeline accepts several types of inputs which are detailed below:
  
      - `pipeline(table, query)`
      - `pipeline(table, [query])`
      - `pipeline(table=table, query=query)`
      - `pipeline(table=table, query=[query])`
      - `pipeline({"table": table, "query": query})`
      - `pipeline({"table": table, "query": [query]})`
      - `pipeline([{"table": table, "query": query}, {"table": table, "query": query}])`
  
      The `table` argument should be a dict or a DataFrame built from that dict, containing the whole table:
  
      Example:
  
      ```python
      data = {
          "actors": ["brad pitt", "leonardo di caprio", "george clooney"],
          "age": ["56", "45", "59"],
          "number of movies": ["87", "53", "69"],
          "date of birth": ["7 february 1967", "10 june 1996", "28 november 1967"],
      }
      ```
  
      This dictionary can be passed in as such, or can be converted to a pandas DataFrame:
  
      Example:
  
      ```python
      import pandas as pd
  
      table = pd.DataFrame.from_dict(data)
      ```
  
      Args:
          table (`pd.DataFrame` or `Dict`):
              Pandas DataFrame or dictionary that will be converted to a DataFrame containing all the table values.
              See above for an example of dictionary.
          query (`str` or `List[str]`):
              Query or list of queries that will be sent to the model alongside the table.
          sequential (`bool`, *optional*, defaults to `False`):
              Whether to do inference sequentially or as a batch. Batching is faster, but models like SQA require the
              inference to be done sequentially to extract relations within sequences, given their conversational
              nature.
          padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `False`):
              Activates and controls padding. Accepts the following values:
  
              - `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single
                sequence if provided).
              - `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum
                acceptable input length for the model if that argument is not provided.
              - `False` or `'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different
                lengths).
  
          truncation (`bool`, `str` or [`TapasTruncationStrategy`], *optional*, defaults to `False`):
              Activates and controls truncation. Accepts the following values:
  
              - `True` or `'drop_rows_to_fit'`: Truncate to a maximum length specified with the argument `max_length`
                or to the maximum acceptable input length for the model if that argument is not provided. This will
                truncate row by row, removing rows from the table.
              - `False` or `'do_not_truncate'` (default): No truncation (i.e., can output batch with sequence lengths
                greater than the model maximum admissible input size).
  
  
      Return:
          A dictionary or a list of dictionaries containing results: Each result is a dictionary with the following
          keys:
  
          - **answer** (`str`) -- The answer of the query given the table. If there is an aggregator, the answer will
            be preceded by `AGGREGATOR >`.
          - **coordinates** (`List[Tuple[int, int]]`) -- Coordinates of the cells of the answers.
          - **cells** (`List[str]`) -- List of strings made up of the answer cell values.
          - **aggregator** (`str`) -- If the model has an aggregator, this returns the aggregator.
      """
      pipeline_inputs = self._args_parser(*args, **kwargs)
  
      results = super().__call__(pipeline_inputs, **kwargs)
      if len(results) == 1:
          return results[0]
      return results
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/pipelines/table_question_answering.py
imports: import collections
  import types
  import numpy
  from ..utils import add_end_docstrings, is_tensorflow_probability_available, is_tf_available, is_torch_available, requires_backends
  from .base import PIPELINE_INIT_ARGS, ArgumentHandler, Dataset, Pipeline, PipelineException
label_desc: Use image node_id 4 for calling the TableQuestionAnsweringPipeline obj's underlying member method code with example usage: obj.__call__() and returns: results, results