Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- squadv1
|
4 |
+
tags:
|
5 |
+
- question-generation
|
6 |
+
---
|
7 |
+
|
8 |
+
## T5 for multi-task QA and QG
|
9 |
+
This is multi-task [t5-base](https://arxiv.org/abs/1910.10683) model trained for question answering and answer aware question generation tasks.
|
10 |
+
|
11 |
+
For question generation the answer spans are highlighted within the text with special highlight tokens (`<hl>`) and prefixed with 'generate question: '. For QA the input is processed like this `question: question_text context: context_text </s>`
|
12 |
+
|
13 |
+
You can play with the model using the inference API. Here's how you can use it
|
14 |
+
|
15 |
+
For QG
|
16 |
+
|
17 |
+
`generate question: <hl> 42 <hl> is the answer to life, the universe and everything. </s>`
|
18 |
+
|
19 |
+
For QA
|
20 |
+
|
21 |
+
`question: What is 42 context: 42 is the answer to life, the universe and everything. </s>`
|
22 |
+
|
23 |
+
For more deatils see [this](https://github.com/sabhi27/question_generation) repo.
|
24 |
+
|
25 |
+
|
26 |
+
### Model in action 🚀
|
27 |
+
|
28 |
+
You'll need to clone the [repo](https://github.com/sabhi27/question_generation).
|
29 |
+
|
30 |
+
[](https://colab.research.google.com/github/sabhi27/question_generation/blob/master/question_generation.ipynb)
|
31 |
+
|
32 |
+
```python3
|
33 |
+
from pipelines import pipeline
|
34 |
+
nlp = pipeline("multitask-qa-qg", model="sabhi/t5-base-qa-qg")
|
35 |
+
|
36 |
+
# to generate questions simply pass the text
|
37 |
+
nlp("42 is the answer to life, the universe and everything.")
|
38 |
+
=> [{'answer': '42', 'question': 'What is the answer to life, the universe and everything?'}]
|
39 |
+
|
40 |
+
# for qa pass a dict with "question" and "context"
|
41 |
+
nlp({
|
42 |
+
"question": "What is 42 ?",
|
43 |
+
"context": "42 is the answer to life, the universe and everything."
|
44 |
+
})
|
45 |
+
=> 'the answer to life, the universe and everything'
|
46 |
+
```
|