Views
No views yet
<extra_id_0> and the labels are formatted as <extra_id_0>span<extra_id_0>. Unlike Splinter, only one span is mask at a time.1from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
2model = AutoModelForSeq2SeqLM.from_pretrained('tau/t5-v1_1-large-rss')
3tokenizer = AutoTokenizer.from_pretrained('tau/t5-v1_1-large-rss')
4
5passage = 'Barack Hussein Obama II is an American politician and attorney who served as the 44th president of the United States from 2009 to 2017. '
6question = 'When was Obama inaugurated?'
7text = f'Text: {passage}.\nQuestion: {question}\nAnswer:{tokenizer.additional_special_tokens[0]}.'
8encoded_input = tokenizer(text, return_tensors='pt')
9output_ids = model.generate(input_ids=encoded_input.input_ids, attention_mask=encoded_input.attention_mask,
10 eos_token_id=tokenizer.additional_special_tokens_ids[1], num_beams=1, max_length=512, min_length=3)
11tokenizer.decode(output_ids[0])"<pad><extra_id_0> 2009<extra_id_1>", while the one generated by the original T5-v1.1-large is "<pad><extra_id_0> On January 20, 2009<extra_id_1>" - a correct yet non-extractive answer.| Model \ Dataset | SQuAD | TriviaQA | NaturalQs | NewsQA | SearchQA | HotpotQA | BioASQ | TextbookQA |
|---|---|---|---|---|---|---|---|---|
| T5 | 50.4 | 61.7 | 42.1 | 19.2 | 24.0 | 43.3 | 55.5 | 17.8 |
| T5-rss | 71.4 | 69.3 | 57.2 | 43.2 | 29.7 | 59.0 | 65.5 | 39.0 |
1@inproceedings{ram-etal-2021-shot,
2 title = "Few-Shot Question Answering by Pretraining Span Selection",
3 author = "Ram, Ori and
4 Kirstain, Yuval and
5 Berant, Jonathan and
6 Globerson, Amir and
7 Levy, Omer",
8 booktitle = "Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)",
9 month = aug,
10 year = "2021",
11 address = "Online",
12 publisher = "Association for Computational Linguistics",
13 url = "https://aclanthology.org/2021.acl-long.239",
14 doi = "10.18653/v1/2021.acl-long.239",
15 pages = "3066--3079",
16},
17@misc{castel2021optimal,
18 title={How Optimal is Greedy Decoding for Extractive Question Answering?},
19 author={Or Castel and Ori Ram and Avia Efrat and Omer Levy},
20 year={2021},
21 eprint={2108.05857},
22 archivePrefix={arXiv},
23 primaryClass={cs.CL}
24}
25