How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("table-question-answering", model="thealper2/tapas-wtq")
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForTableQuestionAnswering

tokenizer = AutoTokenizer.from_pretrained("thealper2/tapas-wtq")
model = AutoModelForTableQuestionAnswering.from_pretrained("thealper2/tapas-wtq", device_map="auto")
Quick Links

tapas-wtq

google/tapas-base fine-tuned on WikiTableQuestions for table question answering with cell selection and aggregation (NONE / SUM / AVERAGE / COUNT).

Results

Denotation accuracy is the fraction of questions whose predicted answer matches the gold answer after normalisation; it is the metric used for model selection.

Split Examples Denotation acc. Exact match Cell selection acc. Aggregation acc.
validation 2483 0.3178 0.3178 0.2715 0.7412

Usage

import pandas as pd
from transformers import TapasForQuestionAnswering, TapasTokenizer

repo = "thealper2/tapas-wtq"
tokenizer = TapasTokenizer.from_pretrained(repo)
model = TapasForQuestionAnswering.from_pretrained(repo)

table = pd.DataFrame(
    {"City": ["Paris", "Berlin", "Madrid"], "Population": ["2148000", "3645000", "3223000"]}
).astype(str)
inputs = tokenizer(table=table, queries=["Which city has the largest population?"],
                   return_tensors="pt")
outputs = model(**inputs)
coords, agg = tokenizer.convert_logits_to_predictions(
    inputs, outputs.logits.detach(), outputs.logits_aggregation.detach()
)
print([table.iat[c] for c in coords[0]], agg)

Training hyperparameters

  • learning_rate: 5e-05
  • num_train_epochs: 4.0
  • per_device_train_batch_size: 16
  • gradient_accumulation_steps: 2
  • weight_decay: 0.01
  • warmup_ratio: 0.1
  • lr_scheduler_type: linear
  • max_seq_length: 512
  • seed: 42
  • training time: 19.8 min

The full configuration is included as training_config.json, the per-step training history as history.json.

Downloads last month
18
Safetensors
Model size
0.1B params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for thealper2/tapas-wtq

Finetuned
(1)
this model

Dataset used to train thealper2/tapas-wtq

Evaluation results