system HF staff commited on
Commit
e54692c
1 Parent(s): ebf6078

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +62 -0
README.md ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - squad
4
+ tags:
5
+ - question-generation
6
+ - distilt5
7
+ - distilt5-qg
8
+ widget:
9
+ - text: "generate question: <hl> 42 <hl> is the answer to life, the universe and everything. </s>"
10
+ - text: "question: What is 42 context: 42 is the answer to life, the universe and everything. </s>"
11
+ license: "MIT"
12
+ ---
13
+
14
+ ## DistilT5 for question-generation
15
+ This is distilled version of [t5-small-qa-qg-hl](https://huggingface.co/valhalla/t5-small-qa-qg-hl) model trained for question answering and answer aware question generation tasks.
16
+
17
+ The model is distilled using the **No Teacher Distillation** method proposed by Huggingface, [here](https://github.com/huggingface/transformers/tree/master/examples/seq2seq#distilbart).
18
+
19
+ We just copy alternating layers from `t5-small-qa-qg-hl` and finetune more on the same data. Following table lists other distilled models and their metrics.
20
+
21
+ | Name | BLEU-4 | METEOR | ROUGE-L | QA-EM | QA-F1 |
22
+ |---------------------------------------------------------------------------------|---------|---------|---------|--------|--------|
23
+ | [distilt5-qg-hl-6-4](https://huggingface.co/valhalla/distilt5-qg-hl-6-4) | 18.4141 | 24.8417 | 40.3435 | - | - |
24
+ | [distilt5-qa-qg-hl-6-4](https://huggingface.co/valhalla/distilt5-qa-qg-hl-6-4) | 18.6493 | 24.9685 | 40.5605 | 76.13 | 84.659 |
25
+ | [distilt5-qg-hl-12-6](https://huggingface.co/valhalla/distilt5-qg-hl-12-6) | 20.5275 | 26.5010 | 43.2676 | - | - |
26
+ | [distilt5-qa-qg-hl-12-6](https://huggingface.co/valhalla/distilt5-qa-qg-hl-12-6)| 20.6109 | 26.4533 | 43.0895 | 81.61 | 89.831 |
27
+
28
+
29
+ You can play with the model using the inference API. Here's how you can use it
30
+
31
+ For QG
32
+
33
+ `generate question: <hl> 42 <hl> is the answer to life, the universe and everything.`
34
+
35
+ For QA
36
+
37
+ `question: What is 42 context: 42 is the answer to life, the universe and everything.`
38
+
39
+ For more deatils see [this](https://github.com/patil-suraj/question_generation) repo.
40
+
41
+ ### Model in action 🚀
42
+
43
+ You'll need to clone the [repo](https://github.com/patil-suraj/question_generation).
44
+
45
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/patil-suraj/question_generation/blob/master/question_generation.ipynb)
46
+
47
+
48
+ ```python3
49
+ from pipelines import pipeline
50
+ nlp = pipeline("multitask-qa-qg", model="valhalla/distilt5-qa-qg-hl-6-4")
51
+
52
+ # to generate questions simply pass the text
53
+ nlp("42 is the answer to life, the universe and everything.")
54
+ => [{'answer': '42', 'question': 'What is the answer to life?'}]
55
+
56
+ # for qa pass a dict with "question" and "context"
57
+ nlp({
58
+ "question": "What is 42 ?",
59
+ "context": "42 is the answer to life, the universe and everything."
60
+ })
61
+ => 'the answer to life, the universe and everything'
62
+ ```