<jupyter_start><jupyter_text><jupyter_code>!pip install -q transformers==4.4.2
import torch
torch.__version__
!pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.8.0+cu101.html
from transformers import pipeline
import pandas as pd
tqa = pipeline(task="table-question-answering",
               model = "google/tapas-base-finetuned-wtq")
table = pd.read_csv("data.csv")
table = table.astype(str)
table
query = "who has scored the highest runs?"
print(tqa(table=table, query=query)['answer'])
query = ["<NAME> highest score?",
         "Which team does he play for?"]
answer = tqa(table=table, query=query)
for ans in answer:
  print(ans['answer'])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14224137931034483, 'fraction_numerical': 0.01293103448275862, 'mean_word_length': 5.114035087719298, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '442124', 'license': 'MIT', 'n_tokens_mistral': 247, 'n_tokens_neox': 241, 'n_words': 56, 'path': 'Table_Q&A_Transformers.ipynb', 'repo_name': 'dpk-a7/Deep-learning', 'size': '702'}