Views
No views yet
tapex-base model fine-tuned on the WikiSQL dataset.| Question | Answer |
|---|---|
| tell me what the notes are for south australia | no slogan on current series |
| what position does the player who played for butler cc (ks) play? | guard-forward |
| how many schools did player number 3 play at? | 1.0 |
| how many winning drivers in the kraco twin 125 (r2) race were there? | 1.0 |
| for the episode(s) aired in the u.s. on 4 april 2008, what were the names? | "bust a move" part one, "bust a move" part two |
1from transformers import TapexTokenizer, BartForConditionalGeneration
2import pandas as pd
3
4tokenizer = TapexTokenizer.from_pretrained("microsoft/tapex-large-finetuned-wikisql")
5model = BartForConditionalGeneration.from_pretrained("microsoft/tapex-large-finetuned-wikisql")
6
7data = {
8 "year": [1896, 1900, 1904, 2004, 2008, 2012],
9 "city": ["athens", "paris", "st. louis", "athens", "beijing", "london"]
10}
11table = pd.DataFrame.from_dict(data)
12
13# tapex accepts uncased input since it is pre-trained on the uncased corpus
14query = "In which year did beijing host the Olympic Games?"
15encoding = tokenizer(table=table, query=query, return_tensors="pt")
16
17outputs = model.generate(**encoding)
18
19print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
20# [' 2008.0']1@inproceedings{
2 liu2022tapex,
3 title={{TAPEX}: Table Pre-training via Learning a Neural {SQL} Executor},
4 author={Qian Liu and Bei Chen and Jiaqi Guo and Morteza Ziyadi and Zeqi Lin and Weizhu Chen and Jian-Guang Lou},
5 booktitle={International Conference on Learning Representations},
6 year={2022},
7 url={https://openreview.net/forum?id=O50443AsCP}
8}