模型:

neulab/omnitab-large-1024shot-finetuned-wtq-1024shot

英文

OmniTab

OmniTab是一个基于表格的问答模型,提出于 OmniTab: Pretraining with Natural and Synthetic Data for Few-shot Table-based Question Answering 。原始Github仓库为 https://github.com/jzbjyb/OmniTab

描述

neulab/omnitab-large-1024shot-finetuned-wtq-1024shot(基于BART架构)以neulab/omnitab-large-1024shot为初始化,在 WikiTableQuestions 的1024-shot环境中进行了微调。

使用方法

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import pandas as pd

tokenizer = AutoTokenizer.from_pretrained("neulab/omnitab-large-1024shot-finetuned-wtq-1024shot")
model = AutoModelForSeq2SeqLM.from_pretrained("neulab/omnitab-large-1024shot-finetuned-wtq-1024shot")

data = {
    "year": [1896, 1900, 1904, 2004, 2008, 2012],
    "city": ["athens", "paris", "st. louis", "athens", "beijing", "london"]
}
table = pd.DataFrame.from_dict(data)

query = "In which year did beijing host the Olympic Games?"
encoding = tokenizer(table=table, query=query, return_tensors="pt")

outputs = model.generate(**encoding)

print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
# [' 2008']

参考文献

@inproceedings{jiang-etal-2022-omnitab,
  title = "{O}mni{T}ab: Pretraining with Natural and Synthetic Data for Few-shot Table-based Question Answering",
  author = "Jiang, Zhengbao and Mao, Yi and He, Pengcheng and Neubig, Graham and Chen, Weizhu",
  booktitle = "Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies",
  month = jul,
  year = "2022",
}