tapas-wtq

29 downloads 0 likes on Hugging Face updated

Model card

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.