asahi417 commited on
Commit
b4749fd
1 Parent(s): f05f8ea

model update

Browse files
README.md ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+ license: cc-by-4.0
4
+ metrics:
5
+ - bleu4
6
+ - meteor
7
+ - rouge-l
8
+ - bertscore
9
+ - moverscore
10
+ language: en
11
+ datasets:
12
+ - lmqg/qag_squad
13
+ pipeline_tag: text2text-generation
14
+ tags:
15
+ - questions and answers generation
16
+ widget:
17
+ - text: "generate question and answer: Beyonce further expanded her acting career, starring as blues singer Etta James in the 2008 musical biopic, Cadillac Records."
18
+ example_title: "Questions & Answers Generation Example 1"
19
+ model-index:
20
+ - name: lmqg/flan-t5-small-squad-qag
21
+ results:
22
+ - task:
23
+ name: Text2text Generation
24
+ type: text2text-generation
25
+ dataset:
26
+ name: lmqg/qag_squad
27
+ type: default
28
+ args: default
29
+ metrics:
30
+ - name: QAAlignedF1Score-BERTScore (Question & Answer Generation)
31
+ type: qa_aligned_f1_score_bertscore_question_answer_generation
32
+ value: 92.3
33
+ - name: QAAlignedRecall-BERTScore (Question & Answer Generation)
34
+ type: qa_aligned_recall_bertscore_question_answer_generation
35
+ value: 91.71
36
+ - name: QAAlignedPrecision-BERTScore (Question & Answer Generation)
37
+ type: qa_aligned_precision_bertscore_question_answer_generation
38
+ value: 92.92
39
+ - name: QAAlignedF1Score-MoverScore (Question & Answer Generation)
40
+ type: qa_aligned_f1_score_moverscore_question_answer_generation
41
+ value: 63.74
42
+ - name: QAAlignedRecall-MoverScore (Question & Answer Generation)
43
+ type: qa_aligned_recall_moverscore_question_answer_generation
44
+ value: 62.2
45
+ - name: QAAlignedPrecision-MoverScore (Question & Answer Generation)
46
+ type: qa_aligned_precision_moverscore_question_answer_generation
47
+ value: 65.5
48
+ ---
49
+
50
+ # Model Card of `lmqg/flan-t5-small-squad-qag`
51
+ This model is fine-tuned version of [google/flan-t5-small](https://huggingface.co/google/flan-t5-small) for question & answer pair generation task on the [lmqg/qag_squad](https://huggingface.co/datasets/lmqg/qag_squad) (dataset_name: default) via [`lmqg`](https://github.com/asahi417/lm-question-generation).
52
+
53
+
54
+ ### Overview
55
+ - **Language model:** [google/flan-t5-small](https://huggingface.co/google/flan-t5-small)
56
+ - **Language:** en
57
+ - **Training data:** [lmqg/qag_squad](https://huggingface.co/datasets/lmqg/qag_squad) (default)
58
+ - **Online Demo:** [https://autoqg.net/](https://autoqg.net/)
59
+ - **Repository:** [https://github.com/asahi417/lm-question-generation](https://github.com/asahi417/lm-question-generation)
60
+ - **Paper:** [https://arxiv.org/abs/2210.03992](https://arxiv.org/abs/2210.03992)
61
+
62
+ ### Usage
63
+ - With [`lmqg`](https://github.com/asahi417/lm-question-generation#lmqg-language-model-for-question-generation-)
64
+ ```python
65
+ from lmqg import TransformersQG
66
+
67
+ # initialize model
68
+ model = TransformersQG(language="en", model="lmqg/flan-t5-small-squad-qag")
69
+
70
+ # model prediction
71
+ question_answer_pairs = model.generate_qa("William Turner was an English painter who specialised in watercolour landscapes")
72
+
73
+ ```
74
+
75
+ - With `transformers`
76
+ ```python
77
+ from transformers import pipeline
78
+
79
+ pipe = pipeline("text2text-generation", "lmqg/flan-t5-small-squad-qag")
80
+ output = pipe("generate question and answer: Beyonce further expanded her acting career, starring as blues singer Etta James in the 2008 musical biopic, Cadillac Records.")
81
+
82
+ ```
83
+
84
+ ## Evaluation
85
+
86
+
87
+ - ***Metric (Question & Answer Generation)***: [raw metric file](https://huggingface.co/lmqg/flan-t5-small-squad-qag/raw/main/eval/metric.first.answer.paragraph.questions_answers.lmqg_qag_squad.default.json)
88
+
89
+ | | Score | Type | Dataset |
90
+ |:--------------------------------|--------:|:--------|:-----------------------------------------------------------------|
91
+ | QAAlignedF1Score (BERTScore) | 92.3 | default | [lmqg/qag_squad](https://huggingface.co/datasets/lmqg/qag_squad) |
92
+ | QAAlignedF1Score (MoverScore) | 63.74 | default | [lmqg/qag_squad](https://huggingface.co/datasets/lmqg/qag_squad) |
93
+ | QAAlignedPrecision (BERTScore) | 92.92 | default | [lmqg/qag_squad](https://huggingface.co/datasets/lmqg/qag_squad) |
94
+ | QAAlignedPrecision (MoverScore) | 65.5 | default | [lmqg/qag_squad](https://huggingface.co/datasets/lmqg/qag_squad) |
95
+ | QAAlignedRecall (BERTScore) | 91.71 | default | [lmqg/qag_squad](https://huggingface.co/datasets/lmqg/qag_squad) |
96
+ | QAAlignedRecall (MoverScore) | 62.2 | default | [lmqg/qag_squad](https://huggingface.co/datasets/lmqg/qag_squad) |
97
+
98
+
99
+
100
+ ## Training hyperparameters
101
+
102
+ The following hyperparameters were used during fine-tuning:
103
+ - dataset_path: lmqg/qag_squad
104
+ - dataset_name: default
105
+ - input_types: ['paragraph']
106
+ - output_types: ['questions_answers']
107
+ - prefix_types: ['qag']
108
+ - model: google/flan-t5-small
109
+ - max_length: 512
110
+ - max_length_output: 256
111
+ - epoch: 14
112
+ - batch: 16
113
+ - lr: 0.0001
114
+ - fp16: False
115
+ - random_seed: 1
116
+ - gradient_accumulation_steps: 4
117
+ - label_smoothing: 0.0
118
+
119
+ The full configuration can be found at [fine-tuning config file](https://huggingface.co/lmqg/flan-t5-small-squad-qag/raw/main/trainer_config.json).
120
+
121
+ ## Citation
122
+ ```
123
+ @inproceedings{ushio-etal-2022-generative,
124
+ title = "{G}enerative {L}anguage {M}odels for {P}aragraph-{L}evel {Q}uestion {G}eneration",
125
+ author = "Ushio, Asahi and
126
+ Alva-Manchego, Fernando and
127
+ Camacho-Collados, Jose",
128
+ booktitle = "Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing",
129
+ month = dec,
130
+ year = "2022",
131
+ address = "Abu Dhabi, U.A.E.",
132
+ publisher = "Association for Computational Linguistics",
133
+ }
134
+
135
+ ```
added_tokens.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "<hl>": 32100
3
+ }
config.json ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "lmqg_output/flan-t5-small-squad-qag/model_mzgdpa/epoch_10",
3
+ "add_prefix": true,
4
+ "architectures": [
5
+ "T5ForConditionalGeneration"
6
+ ],
7
+ "d_ff": 1024,
8
+ "d_kv": 64,
9
+ "d_model": 512,
10
+ "decoder_start_token_id": 0,
11
+ "dense_act_fn": "gelu_new",
12
+ "dropout_rate": 0.1,
13
+ "eos_token_id": 1,
14
+ "feed_forward_proj": "gated-gelu",
15
+ "initializer_factor": 1.0,
16
+ "is_encoder_decoder": true,
17
+ "is_gated_act": true,
18
+ "layer_norm_epsilon": 1e-06,
19
+ "model_type": "t5",
20
+ "n_positions": 512,
21
+ "num_decoder_layers": 8,
22
+ "num_heads": 6,
23
+ "num_layers": 8,
24
+ "output_past": true,
25
+ "pad_token_id": 0,
26
+ "relative_attention_max_distance": 128,
27
+ "relative_attention_num_buckets": 32,
28
+ "task_specific_params": {
29
+ "summarization": {
30
+ "early_stopping": true,
31
+ "length_penalty": 2.0,
32
+ "max_length": 200,
33
+ "min_length": 30,
34
+ "no_repeat_ngram_size": 3,
35
+ "num_beams": 4,
36
+ "prefix": "summarize: "
37
+ },
38
+ "translation_en_to_de": {
39
+ "early_stopping": true,
40
+ "max_length": 300,
41
+ "num_beams": 4,
42
+ "prefix": "translate English to German: "
43
+ },
44
+ "translation_en_to_fr": {
45
+ "early_stopping": true,
46
+ "max_length": 300,
47
+ "num_beams": 4,
48
+ "prefix": "translate English to French: "
49
+ },
50
+ "translation_en_to_ro": {
51
+ "early_stopping": true,
52
+ "max_length": 300,
53
+ "num_beams": 4,
54
+ "prefix": "translate English to Romanian: "
55
+ }
56
+ },
57
+ "tie_word_embeddings": false,
58
+ "torch_dtype": "float32",
59
+ "transformers_version": "4.21.2",
60
+ "use_cache": true,
61
+ "vocab_size": 32101
62
+ }
eval/metric.first.answer.paragraph.questions_answers.lmqg_qag_squad.default.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"validation": {"Bleu_1": 0.20405607221787056, "Bleu_2": 0.11651923206781724, "Bleu_3": 0.0674889034467983, "Bleu_4": 0.0442579024927662, "METEOR": 0.25221814883009747, "ROUGE_L": 0.24423036742390483, "BERTScore": 0.8666516939510628, "MoverScore": 0.5828986309013283, "QAAlignedF1Score (BERTScore)": 0.91873763482451, "QAAlignedRecall (BERTScore)": 0.9116887006516031, "QAAlignedPrecision (BERTScore)": 0.9261561570760444, "QAAlignedF1Score (MoverScore)": 0.6360174426233278, "QAAlignedRecall (MoverScore)": 0.6176346680055701, "QAAlignedPrecision (MoverScore)": 0.657378256046374}, "test": {"Bleu_1": 0.18825629891213996, "Bleu_2": 0.10563153189008037, "Bleu_3": 0.059361680910644955, "Bleu_4": 0.03795863394065141, "METEOR": 0.2443435239912263, "ROUGE_L": 0.22462210246221723, "BERTScore": 0.866851497550421, "MoverScore": 0.5813492651878985, "QAAlignedF1Score (BERTScore)": 0.9229931992254793, "QAAlignedRecall (BERTScore)": 0.9171223903676029, "QAAlignedPrecision (BERTScore)": 0.9291854900131855, "QAAlignedF1Score (MoverScore)": 0.6373537849135575, "QAAlignedRecall (MoverScore)": 0.6220281269909166, "QAAlignedPrecision (MoverScore)": 0.6549956214714001}}
eval/samples.test.hyp.paragraph.questions_answers.lmqg_qag_squad.default.txt ADDED
The diff for this file is too large to render. See raw diff
 
eval/samples.validation.hyp.paragraph.questions_answers.lmqg_qag_squad.default.txt ADDED
The diff for this file is too large to render. See raw diff
 
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:22164ca2e3333a6e4e19e39887b8f185f50f5937c83c6a05295aa2185e5853bb
3
+ size 307799557
special_tokens_map.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<hl>"
4
+ ],
5
+ "eos_token": "</s>",
6
+ "pad_token": "<pad>",
7
+ "unk_token": "<unk>"
8
+ }
spiece.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d60acb128cf7b7f2536e8f38a5b18a05535c9e14c7a355904270e15b0945ea86
3
+ size 791656
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<extra_id_0>",
4
+ "<extra_id_1>",
5
+ "<extra_id_2>",
6
+ "<extra_id_3>",
7
+ "<extra_id_4>",
8
+ "<extra_id_5>",
9
+ "<extra_id_6>",
10
+ "<extra_id_7>",
11
+ "<extra_id_8>",
12
+ "<extra_id_9>",
13
+ "<extra_id_10>",
14
+ "<extra_id_11>",
15
+ "<extra_id_12>",
16
+ "<extra_id_13>",
17
+ "<extra_id_14>",
18
+ "<extra_id_15>",
19
+ "<extra_id_16>",
20
+ "<extra_id_17>",
21
+ "<extra_id_18>",
22
+ "<extra_id_19>",
23
+ "<extra_id_20>",
24
+ "<extra_id_21>",
25
+ "<extra_id_22>",
26
+ "<extra_id_23>",
27
+ "<extra_id_24>",
28
+ "<extra_id_25>",
29
+ "<extra_id_26>",
30
+ "<extra_id_27>",
31
+ "<extra_id_28>",
32
+ "<extra_id_29>",
33
+ "<extra_id_30>",
34
+ "<extra_id_31>",
35
+ "<extra_id_32>",
36
+ "<extra_id_33>",
37
+ "<extra_id_34>",
38
+ "<extra_id_35>",
39
+ "<extra_id_36>",
40
+ "<extra_id_37>",
41
+ "<extra_id_38>",
42
+ "<extra_id_39>",
43
+ "<extra_id_40>",
44
+ "<extra_id_41>",
45
+ "<extra_id_42>",
46
+ "<extra_id_43>",
47
+ "<extra_id_44>",
48
+ "<extra_id_45>",
49
+ "<extra_id_46>",
50
+ "<extra_id_47>",
51
+ "<extra_id_48>",
52
+ "<extra_id_49>",
53
+ "<extra_id_50>",
54
+ "<extra_id_51>",
55
+ "<extra_id_52>",
56
+ "<extra_id_53>",
57
+ "<extra_id_54>",
58
+ "<extra_id_55>",
59
+ "<extra_id_56>",
60
+ "<extra_id_57>",
61
+ "<extra_id_58>",
62
+ "<extra_id_59>",
63
+ "<extra_id_60>",
64
+ "<extra_id_61>",
65
+ "<extra_id_62>",
66
+ "<extra_id_63>",
67
+ "<extra_id_64>",
68
+ "<extra_id_65>",
69
+ "<extra_id_66>",
70
+ "<extra_id_67>",
71
+ "<extra_id_68>",
72
+ "<extra_id_69>",
73
+ "<extra_id_70>",
74
+ "<extra_id_71>",
75
+ "<extra_id_72>",
76
+ "<extra_id_73>",
77
+ "<extra_id_74>",
78
+ "<extra_id_75>",
79
+ "<extra_id_76>",
80
+ "<extra_id_77>",
81
+ "<extra_id_78>",
82
+ "<extra_id_79>",
83
+ "<extra_id_80>",
84
+ "<extra_id_81>",
85
+ "<extra_id_82>",
86
+ "<extra_id_83>",
87
+ "<extra_id_84>",
88
+ "<extra_id_85>",
89
+ "<extra_id_86>",
90
+ "<extra_id_87>",
91
+ "<extra_id_88>",
92
+ "<extra_id_89>",
93
+ "<extra_id_90>",
94
+ "<extra_id_91>",
95
+ "<extra_id_92>",
96
+ "<extra_id_93>",
97
+ "<extra_id_94>",
98
+ "<extra_id_95>",
99
+ "<extra_id_96>",
100
+ "<extra_id_97>",
101
+ "<extra_id_98>",
102
+ "<extra_id_99>"
103
+ ],
104
+ "eos_token": "</s>",
105
+ "extra_ids": 100,
106
+ "model_max_length": 512,
107
+ "name_or_path": "lmqg_output/flan-t5-small-squad-qag/model_mzgdpa/epoch_10",
108
+ "pad_token": "<pad>",
109
+ "sp_model_kwargs": {},
110
+ "special_tokens_map_file": "/home/younes_huggingface_co/.cache/huggingface/hub/models--google--t5-v1_1-small/snapshots/fb7e6cba609f7bab11c614294bc04f82f613c7b1/special_tokens_map.json",
111
+ "tokenizer_class": "T5Tokenizer",
112
+ "unk_token": "<unk>"
113
+ }
trainer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"dataset_path": "lmqg/qag_squad", "dataset_name": "default", "input_types": ["paragraph"], "output_types": ["questions_answers"], "prefix_types": ["qag"], "model": "google/flan-t5-small", "max_length": 512, "max_length_output": 256, "epoch": 14, "batch": 16, "lr": 0.0001, "fp16": false, "random_seed": 1, "gradient_accumulation_steps": 4, "label_smoothing": 0.0}