Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- race
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
library_name: transformers
|
8 |
+
pipeline_tag: text2text-generation
|
9 |
+
---
|
10 |
+
# t5-large fine-tuned to RACE for Generating Question+Answer
|
11 |
+
- Input: `context` (e.g. news article)
|
12 |
+
- Output: `question <sep> answer`
|
13 |
+
|
14 |
+
## Model Details
|
15 |
+
|
16 |
+
t5-large model is fine-tuned to the RACE dataset where the input is the context/passage and the output is the question followed by the answer. This is the first component in the question generation pipeline (i.e. `g1`) in our [MQAG paper](https://arxiv.org/abs/2301.12307),
|
17 |
+
or please refer to the GitHub repo of this project: https://github.com/potsawee/mqag0.
|
18 |
+
|
19 |
+
## How to Use the Model
|
20 |
+
|
21 |
+
Use the code below to get started with the model.
|
22 |
+
|
23 |
+
```python
|
24 |
+
>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
25 |
+
|
26 |
+
>>> tokenizer = AutoTokenizer.from_pretrained("potsawee/t5-large-generation-race-QuestionAnswer")
|
27 |
+
>>> model = AutoModelForSeq2SeqLM.from_pretrained("potsawee/t5-large-generation-race-QuestionAnswer")
|
28 |
+
|
29 |
+
>>> context = r"""
|
30 |
+
... World number one Novak Djokovic says he is hoping for a "positive decision" to allow him
|
31 |
+
... to play at Indian Wells and the Miami Open next month. The United States has extended
|
32 |
+
... its requirement for international visitors to be vaccinated against Covid-19. Proof of vaccination
|
33 |
+
... will be required to enter the country until at least 10 April, but the Serbian has previously
|
34 |
+
... said he is unvaccinated. The 35-year-old has applied for special permission to enter the country.
|
35 |
+
... Indian Wells and the Miami Open - two of the most prestigious tournaments on the tennis calendar
|
36 |
+
... outside the Grand Slams - start on 6 and 20 March respectively. Djokovic says he will return to
|
37 |
+
... the ATP tour in Dubai next week after claiming a record-extending 10th Australian Open title
|
38 |
+
... and a record-equalling 22nd Grand Slam men's title last month.""".replace("\n", "")
|
39 |
+
|
40 |
+
>>> inputs = tokenizer(context, return_tensors="pt")
|
41 |
+
>>> outputs = model.generate(**inputs, max_length=100)
|
42 |
+
>>> question_answer = tokenizer.decode(outputs[0], skip_special_tokens=False)
|
43 |
+
>>> question_answer = question_answer.replace(tokenizer.pad_token, "").replace(tokenizer.eos_token, "")
|
44 |
+
>>> question, answer = question_answer.split(tokenizer.sep_token)
|
45 |
+
|
46 |
+
>>> print("question:", question)
|
47 |
+
question: What is the best title for the passage?
|
48 |
+
>>> print("answer:", answer)
|
49 |
+
answer: Djokovic's application for special permission to enter the United States
|
50 |
+
|
51 |
+
```
|
52 |
+
|
53 |
+
|
54 |
+
## Citation
|
55 |
+
|
56 |
+
```bibtex
|
57 |
+
@article{manakul2023mqag,
|
58 |
+
title={MQAG: Multiple-choice Question Answering and Generation for Assessing Information Consistency in Summarization},
|
59 |
+
author={Manakul, Potsawee and Liusie, Adian and Gales, Mark JF},
|
60 |
+
journal={arXiv preprint arXiv:2301.12307},
|
61 |
+
year={2023}
|
62 |
+
}
|
63 |
+
```
|