Update README.md
Browse files
README.md
CHANGED
@@ -7,4 +7,40 @@ sdk: static
|
|
7 |
pinned: false
|
8 |
---
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
pinned: false
|
8 |
---
|
9 |
|
10 |
+
<p align="center">
|
11 |
+
<img src="https://raw.githubusercontent.com/asahi417/lm-question-generation/master/assets/qg_diagram.png" width="500">
|
12 |
+
</p>
|
13 |
+
|
14 |
+
<br>
|
15 |
+
|
16 |
+
***Language Models for Question Generation (LMQG)*** is the official registry of <a href="paper_link">"Generative Language Models for Paragraph-Level Question Generation, EMNLP 2022"</a>, which has proposed <a href="https://github.com/asahi417/lm-question-generation/blob/master/QG_BENCH.md">QG-Bench</a>, multilingual and multidomain question generation datasets and models.
|
17 |
+
See our <a href="https://github.com/asahi417/lm-question-generation">GitHub</a> for more information.
|
18 |
+
|
19 |
+
Basic usage of our QG model follows below.
|
20 |
+
<pre class="line-numbers">
|
21 |
+
<code class="language-python">
|
22 |
+
pip install lmqg
|
23 |
+
</code>
|
24 |
+
</pre>
|
25 |
+
|
26 |
+
<pre class="line-numbers">
|
27 |
+
<code class="language-python">
|
28 |
+
from lmqg import TransformersQG
|
29 |
+
# initialize model
|
30 |
+
model = TransformersQG(language='en', model='lmqg/t5-large-squad-multitask')
|
31 |
+
# paragraph to generate pairs of question and answer
|
32 |
+
context = "William Turner was an English painter who specialised in watercolour landscapes. He is often known as William Turner of Oxford or just Turner of Oxford to distinguish him from his contemporary, J. M. W. Turner. Many of Turner's paintings depicted the countryside around Oxford. One of his best known pictures is a view of the city of Oxford from Hinksey Hill."
|
33 |
+
# model prediction
|
34 |
+
question_answer = model.generate_qa(context)
|
35 |
+
# the output is a list of tuple (question, answer)
|
36 |
+
print(question_answer)
|
37 |
+
[
|
38 |
+
('Who was an English painter who specialised in watercolour landscapes?', 'William Turner'),
|
39 |
+
("What was William Turner's nickname?", 'William Turner of Oxford'),
|
40 |
+
("What did many of Turner's paintings depict around Oxford?", 'countryside'),
|
41 |
+
("What is one of William Turner's best known paintings?", 'a view of the city of Oxford')
|
42 |
+
]
|
43 |
+
|
44 |
+
</code>
|
45 |
+
</pre>
|
46 |
+
|