Zhengbao Jiang
commited on
Commit
•
7776a74
1
Parent(s):
a38a526
init commit
Browse files- README.md +52 -0
- config.json +38 -0
- merges.txt +0 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tokenizer_config.json +67 -0
- vocab.json +0 -0
README.md
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
tags:
|
4 |
+
- tapex
|
5 |
+
- table-question-answering
|
6 |
+
datasets:
|
7 |
+
- wikitablequestions
|
8 |
+
---
|
9 |
+
|
10 |
+
# OmniTab
|
11 |
+
|
12 |
+
OmniTab is a table-based QA model proposed in [OmniTab: Pretraining with Natural and Synthetic Data for Few-shot Table-based Question Answering](https://arxiv.org/pdf/2207.03637.pdf). The original Github repository is [https://github.com/jzbjyb/OmniTab](https://github.com/jzbjyb/OmniTab).
|
13 |
+
|
14 |
+
## Description
|
15 |
+
|
16 |
+
`neulab/omnitab-large` (based on BART architecture) is initialized with `microsoft/tapex-large` and continuously pretrained on natural and synthetic data.
|
17 |
+
|
18 |
+
## Usage
|
19 |
+
|
20 |
+
```python
|
21 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
22 |
+
import pandas as pd
|
23 |
+
|
24 |
+
tokenizer = AutoTokenizer.from_pretrained("neulab/omnitab-large")
|
25 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("neulab/omnitab-large")
|
26 |
+
|
27 |
+
data = {
|
28 |
+
"year": [1896, 1900, 1904, 2004, 2008, 2012],
|
29 |
+
"city": ["athens", "paris", "st. louis", "athens", "beijing", "london"]
|
30 |
+
}
|
31 |
+
table = pd.DataFrame.from_dict(data)
|
32 |
+
|
33 |
+
query = "In which year did beijing host the Olympic Games?"
|
34 |
+
encoding = tokenizer(table=table, query=query, return_tensors="pt")
|
35 |
+
|
36 |
+
outputs = model.generate(**encoding)
|
37 |
+
|
38 |
+
print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
|
39 |
+
# [' 2008']
|
40 |
+
```
|
41 |
+
|
42 |
+
## Reference
|
43 |
+
|
44 |
+
```bibtex
|
45 |
+
@inproceedings{jiang-etal-2022-omnitab,
|
46 |
+
title = "{O}mni{T}ab: Pretraining with Natural and Synthetic Data for Few-shot Table-based Question Answering",
|
47 |
+
author = "Jiang, Zhengbao and Mao, Yi and He, Pengcheng and Neubig, Graham and Chen, Weizhu",
|
48 |
+
booktitle = "Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies",
|
49 |
+
month = jul,
|
50 |
+
year = "2022",
|
51 |
+
}
|
52 |
+
```
|
config.json
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "neulab/omnitab-large",
|
3 |
+
"activation_dropout": 0.0,
|
4 |
+
"activation_function": "gelu",
|
5 |
+
"architectures": [
|
6 |
+
"BartForConditionalGeneration"
|
7 |
+
],
|
8 |
+
"attention_dropout": 0.1,
|
9 |
+
"bos_token_id": 0,
|
10 |
+
"classifier_dropout": 0.0,
|
11 |
+
"d_model": 1024,
|
12 |
+
"decoder_attention_heads": 16,
|
13 |
+
"decoder_ffn_dim": 4096,
|
14 |
+
"decoder_layerdrop": 0.0,
|
15 |
+
"decoder_layers": 12,
|
16 |
+
"decoder_start_token_id": 2,
|
17 |
+
"dropout": 0.1,
|
18 |
+
"encoder_attention_heads": 16,
|
19 |
+
"encoder_ffn_dim": 4096,
|
20 |
+
"encoder_layerdrop": 0.0,
|
21 |
+
"encoder_layers": 12,
|
22 |
+
"eos_token_id": 2,
|
23 |
+
"forced_bos_token_id": 0,
|
24 |
+
"forced_eos_token_id": 2,
|
25 |
+
"init_std": 0.02,
|
26 |
+
"is_encoder_decoder": true,
|
27 |
+
"max_length": 1024,
|
28 |
+
"max_position_embeddings": 1024,
|
29 |
+
"model_type": "bart",
|
30 |
+
"num_hidden_layers": 12,
|
31 |
+
"pad_token_id": 1,
|
32 |
+
"scale_embedding": false,
|
33 |
+
"torch_dtype": "float32",
|
34 |
+
"transformers_version": "4.17.0.dev0",
|
35 |
+
"use_cache": true,
|
36 |
+
"vocab_size": 50265,
|
37 |
+
"no_repeat_ngram_size": 3
|
38 |
+
}
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3c2d9d68fa775278fe5753e799ad52bd1d5f61e8c48d26fad919194bddb76c47
|
3 |
+
size 812847041
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bos_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "eos_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "unk_token": {"content": "<unk>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "sep_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "pad_token": {"content": "<pad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "cls_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true}}
|
tokenizer_config.json
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"do_lower_case": true,
|
3 |
+
"errors": "replace",
|
4 |
+
"bos_token": {
|
5 |
+
"content": "<s>",
|
6 |
+
"single_word": false,
|
7 |
+
"lstrip": false,
|
8 |
+
"rstrip": false,
|
9 |
+
"normalized": true,
|
10 |
+
"__type": "AddedToken"
|
11 |
+
},
|
12 |
+
"eos_token": {
|
13 |
+
"content": "</s>",
|
14 |
+
"single_word": false,
|
15 |
+
"lstrip": false,
|
16 |
+
"rstrip": false,
|
17 |
+
"normalized": true,
|
18 |
+
"__type": "AddedToken"
|
19 |
+
},
|
20 |
+
"unk_token": {
|
21 |
+
"content": "<unk>",
|
22 |
+
"single_word": false,
|
23 |
+
"lstrip": false,
|
24 |
+
"rstrip": false,
|
25 |
+
"normalized": true,
|
26 |
+
"__type": "AddedToken"
|
27 |
+
},
|
28 |
+
"sep_token": {
|
29 |
+
"content": "</s>",
|
30 |
+
"single_word": false,
|
31 |
+
"lstrip": false,
|
32 |
+
"rstrip": false,
|
33 |
+
"normalized": true,
|
34 |
+
"__type": "AddedToken"
|
35 |
+
},
|
36 |
+
"cls_token": {
|
37 |
+
"content": "<s>",
|
38 |
+
"single_word": false,
|
39 |
+
"lstrip": false,
|
40 |
+
"rstrip": false,
|
41 |
+
"normalized": true,
|
42 |
+
"__type": "AddedToken"
|
43 |
+
},
|
44 |
+
"pad_token": {
|
45 |
+
"content": "<pad>",
|
46 |
+
"single_word": false,
|
47 |
+
"lstrip": false,
|
48 |
+
"rstrip": false,
|
49 |
+
"normalized": true,
|
50 |
+
"__type": "AddedToken"
|
51 |
+
},
|
52 |
+
"mask_token": {
|
53 |
+
"content": "<mask>",
|
54 |
+
"single_word": false,
|
55 |
+
"lstrip": true,
|
56 |
+
"rstrip": false,
|
57 |
+
"normalized": true,
|
58 |
+
"__type": "AddedToken"
|
59 |
+
},
|
60 |
+
"add_prefix_space": true,
|
61 |
+
"max_cell_length": 15,
|
62 |
+
"model_max_length": 1024,
|
63 |
+
"special_tokens_map_file": null,
|
64 |
+
"name_or_path": "neulab/omnitab-large",
|
65 |
+
"use_fast": true,
|
66 |
+
"tokenizer_class": "TapexTokenizer"
|
67 |
+
}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|