DeDeckerThomas commited on
Commit
0fa703d
Β·
1 Parent(s): 8f5c712

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +152 -0
README.md CHANGED
@@ -1,3 +1,155 @@
1
  ---
 
2
  license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language: en
3
  license: mit
4
+ tags:
5
+ - keyphrase-generation
6
+ datasets:
7
+ - midas/inspec
8
+ widget:
9
+ - text: "Keyphrase extraction is a technique in text analysis where you extract the important keyphrases from a text. Since this is a time-consuming process, Artificial Intelligence is used to automate it. Currently, classical machine learning methods, that use statistics and linguistics, are widely used for the extraction process. The fact that these methods have been widely used in the community has the advantage that there are many easy-to-use libraries. Now with the recent innovations in deep learning methods (such as recurrent neural networks and transformers, GANS, …), keyphrase extraction can be improved. These new methods also focus on the semantics and context of a document, which is quite an improvement."
10
+ example_title: "Example 1"
11
+ - text: "In this work, we explore how to learn task specific language models aimed towards learning rich representation of keyphrases from text documents. We experiment with different masking strategies for pre-training transformer language models (LMs) in discriminative as well as generative settings. In the discriminative setting, we introduce a new pre-training objective - Keyphrase Boundary Infilling with Replacement (KBIR), showing large gains in performance (up to 9.26 points in F1) over SOTA, when LM pre-trained using KBIR is fine-tuned for the task of keyphrase extraction. In the generative setting, we introduce a new pre-training setup for BART - KeyBART, that reproduces the keyphrases related to the input text in the CatSeq format, instead of the denoised original input. This also led to gains in performance (up to 4.33 points inF1@M) over SOTA for keyphrase generation. Additionally, we also fine-tune the pre-trained language models on named entity recognition(NER), question answering (QA), relation extraction (RE), abstractive summarization and achieve comparable performance with that of the SOTA, showing that learning rich representation of keyphrases is indeed beneficial for many other fundamental NLP tasks."
12
+ example_title: "Example 2"
13
+ model-index:
14
+ - name: DeDeckerThomas/keyphrase-generation-t5-small-inspec
15
+ results:
16
+ - task:
17
+ type: keyphrase-generation
18
+ name: Keyphrase Generation
19
+ dataset:
20
+ type: midas/inspec
21
+ name: inspec
22
+ metrics:
23
+ - type: F1@M (P)
24
+ value: 0.000
25
+ name: F1@M (P)
26
+ - type: F1@O (P)
27
+ value: 0.000
28
+ name: F1@O (P)
29
+ - type: F1@M (A)
30
+ value: 0.000
31
+ name: F1@M (A)
32
+ - type: F1@O (A)
33
+ value: 0.000
34
+ name: F1@O (A)
35
  ---
36
+ # πŸ”‘ Keyphrase Generation model: KeyBART-inspec
37
+ Keyphrase extraction is a technique in text analysis where you extract the important keyphrases from a text. Since this is a time-consuming process, Artificial Intelligence is used to automate it.
38
+ Currently, classical machine learning methods, that use statistics and linguistics, are widely used for the extraction process. The fact that these methods have been widely used in the community has the advantage that there are many easy-to-use libraries.
39
+ Now with the recent innovations in deep learning methods (such as recurrent neural networks and transformers, GANS, …), keyphrase extraction can be improved. These new methods also focus on the semantics and context of a document, which is quite an improvement.
40
+
41
+
42
+ ## πŸ““ Model Description
43
+ This model is a fine-tuned T5-small model on the Inspec dataset.
44
+
45
+ ## βœ‹ Intended uses & limitations
46
+ ### πŸ›‘ Limitations
47
+ * This keyphrase generation model is very domain-specific and will perform very well on abstracts of scientific papers. It's not recommended to use this model for other domains, but you are free to test it out.
48
+ * Only works for English documents.
49
+ * For a custom model, please consult the training notebook for more information (link incoming).
50
+ * Sometimes the output can make no sense.
51
+
52
+ ### ❓ How to use
53
+ ```python
54
+ # Model parameters
55
+ from transformers import (
56
+ Text2TextGenerationPipeline,
57
+ AutoModelForSeq2SeqLM,
58
+ AutoTokenizer,
59
+ )
60
+ import numpy as np
61
+
62
+
63
+ class KeyphraseGenerationPipeline(Text2TextGenerationPipeline):
64
+ def __init__(self, model, keyphrase_sep_token=";", *args, **kwargs):
65
+ super().__init__(
66
+ model=AutoModelForSeq2SeqLM.from_pretrained(model),
67
+ tokenizer=AutoTokenizer.from_pretrained(model),
68
+ *args,
69
+ **kwargs
70
+ )
71
+ self.keyphrase_sep_token = keyphrase_sep_token
72
+
73
+ def postprocess(self, model_outputs):
74
+ results = super().postprocess(
75
+ model_outputs=model_outputs
76
+ )
77
+ return [[keyphrase.strip() for keyphrase in result.get("generated_text").split(self.keyphrase_sep_token)] for result in results]
78
+ ```
79
+
80
+ ```python
81
+ # Load pipeline
82
+ model_name = "DeDeckerThomas/keyphrase-generation-t5-small-inspec"
83
+ generator = KeyphraseGenerationPipeline(model=model_name)
84
+
85
+ ```python
86
+ text = """
87
+ Keyphrase extraction is a technique in text analysis where you extract the important keyphrases from a text.
88
+ Since this is a time-consuming process, Artificial Intelligence is used to automate it.
89
+ Currently, classical machine learning methods, that use statistics and linguistics, are widely used for the extraction process.
90
+ The fact that these methods have been widely used in the community has the advantage that there are many easy-to-use libraries.
91
+ Now with the recent innovations in deep learning methods (such as recurrent neural networks and transformers, GANS, …), keyphrase extraction can be improved.
92
+ These new methods also focus on the semantics and context of a document, which is quite an improvement.
93
+ """.replace(
94
+ "\n", ""
95
+ )
96
+
97
+ keyphrases = generator(text)
98
+
99
+ print(keyphrases)
100
+
101
+ ```
102
+
103
+ ```
104
+ # Output
105
+ [['keyphrase extraction', 'text analysis', 'artificial intelligence', 'classical machine learning', 'statistics']]
106
+ ```
107
+
108
+ ## πŸ“š Training Dataset
109
+ Inspec is a keyphrase extraction/generation dataset consisting of 2000 English scientific papers from the scientific domains of Computers and Control and Information Technology published between 1998 to 2002. The keyphrases are annotated by professional indexers or editors.
110
+
111
+ You can find more information here: https://huggingface.co/datasets/midas/inspec.
112
+
113
+ ## πŸ‘·β€β™‚οΈ Training procedure
114
+ For more in detail information, you can take a look at the training notebook (link incoming).
115
+
116
+ ### Training parameters
117
+
118
+ | Parameter | Value |
119
+ | --------- | ------|
120
+ | Learning Rate | 5e-5 |
121
+ | Epochs | 50 |
122
+ | Early Stopping Patience | 1 |
123
+
124
+ ### Preprocessing
125
+ ```python
126
+
127
+ ```
128
+
129
+ ### Postprocessing
130
+ ```python
131
+
132
+ ```
133
+ ## πŸ“ Evaluation results
134
+
135
+ One of the traditional evaluation methods is the precision, recall and F1-score @k,m where k is the number that stands for the first k predicted keyphrases and m for the average amount of predicted keyphrases.
136
+ The model achieves the following results on the Inspec test set:
137
+
138
+
139
+ Extractive keyphrases
140
+
141
+ | Dataset | P@5 | R@5 | F1@5 | P@10 | R@10 | F1@10 | P@M | R@M | F1@M | P@O | R@O | F1@O |
142
+ |:-----------------:|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|:----:|:----:|:----:|
143
+ | Inspec Test Set | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
144
+
145
+ Abstractive keyphrases
146
+
147
+ | Dataset | P@5 | R@5 | F1@5 | P@10 | R@10 | F1@10 | P@M | R@M | F1@M | P@O | R@O | F1@O |
148
+ |:-----------------:|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|:----:|:----:|:----:|
149
+ | Inspec Test Set | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
150
+
151
+
152
+ For more information on the evaluation process, you can take a look at the keyphrase extraction evaluation notebook.
153
+
154
+ ## 🚨 Issues
155
+ Please feel free to contact Thomas De Decker for any problems with this model.