asahi417 commited on
Commit
cf06e0f
1 Parent(s): 1d7d242

model update

Browse files
README.md ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - relbert/conceptnet_relational_similarity
4
+ model-index:
5
+ - name: relbert/relbert-roberta-large-nce-e-conceptnet
6
+ results:
7
+ - task:
8
+ name: Relation Mapping
9
+ type: sorting-task
10
+ dataset:
11
+ name: Relation Mapping
12
+ args: relbert/relation_mapping
13
+ type: relation-mapping
14
+ metrics:
15
+ - name: Accuracy
16
+ type: accuracy
17
+ value: 0.702936507936508
18
+ - task:
19
+ name: Analogy Questions (SAT full)
20
+ type: multiple-choice-qa
21
+ dataset:
22
+ name: SAT full
23
+ args: relbert/analogy_questions
24
+ type: analogy-questions
25
+ metrics:
26
+ - name: Accuracy
27
+ type: accuracy
28
+ value: 0.4839572192513369
29
+ - task:
30
+ name: Analogy Questions (SAT)
31
+ type: multiple-choice-qa
32
+ dataset:
33
+ name: SAT
34
+ args: relbert/analogy_questions
35
+ type: analogy-questions
36
+ metrics:
37
+ - name: Accuracy
38
+ type: accuracy
39
+ value: 0.4688427299703264
40
+ - task:
41
+ name: Analogy Questions (BATS)
42
+ type: multiple-choice-qa
43
+ dataset:
44
+ name: BATS
45
+ args: relbert/analogy_questions
46
+ type: analogy-questions
47
+ metrics:
48
+ - name: Accuracy
49
+ type: accuracy
50
+ value: 0.6520289049471929
51
+ - task:
52
+ name: Analogy Questions (Google)
53
+ type: multiple-choice-qa
54
+ dataset:
55
+ name: Google
56
+ args: relbert/analogy_questions
57
+ type: analogy-questions
58
+ metrics:
59
+ - name: Accuracy
60
+ type: accuracy
61
+ value: 0.776
62
+ - task:
63
+ name: Analogy Questions (U2)
64
+ type: multiple-choice-qa
65
+ dataset:
66
+ name: U2
67
+ args: relbert/analogy_questions
68
+ type: analogy-questions
69
+ metrics:
70
+ - name: Accuracy
71
+ type: accuracy
72
+ value: 0.4780701754385965
73
+ - task:
74
+ name: Analogy Questions (U4)
75
+ type: multiple-choice-qa
76
+ dataset:
77
+ name: U4
78
+ args: relbert/analogy_questions
79
+ type: analogy-questions
80
+ metrics:
81
+ - name: Accuracy
82
+ type: accuracy
83
+ value: 0.5069444444444444
84
+ - task:
85
+ name: Analogy Questions (ConceptNet Analogy)
86
+ type: multiple-choice-qa
87
+ dataset:
88
+ name: ConceptNet Analogy
89
+ args: relbert/analogy_questions
90
+ type: analogy-questions
91
+ metrics:
92
+ - name: Accuracy
93
+ type: accuracy
94
+ value: 0.3062080536912752
95
+ - task:
96
+ name: Analogy Questions (TREX Analogy)
97
+ type: multiple-choice-qa
98
+ dataset:
99
+ name: TREX Analogy
100
+ args: relbert/analogy_questions
101
+ type: analogy-questions
102
+ metrics:
103
+ - name: Accuracy
104
+ type: accuracy
105
+ value: 0.5901639344262295
106
+ - task:
107
+ name: Analogy Questions (NELL-ONE Analogy)
108
+ type: multiple-choice-qa
109
+ dataset:
110
+ name: NELL-ONE Analogy
111
+ args: relbert/analogy_questions
112
+ type: analogy-questions
113
+ metrics:
114
+ - name: Accuracy
115
+ type: accuracy
116
+ value: 0.5983333333333334
117
+ - task:
118
+ name: Lexical Relation Classification (BLESS)
119
+ type: classification
120
+ dataset:
121
+ name: BLESS
122
+ args: relbert/lexical_relation_classification
123
+ type: relation-classification
124
+ metrics:
125
+ - name: F1
126
+ type: f1
127
+ value: 0.9044749133644719
128
+ - name: F1 (macro)
129
+ type: f1_macro
130
+ value: 0.9003690113361701
131
+ - task:
132
+ name: Lexical Relation Classification (CogALexV)
133
+ type: classification
134
+ dataset:
135
+ name: CogALexV
136
+ args: relbert/lexical_relation_classification
137
+ type: relation-classification
138
+ metrics:
139
+ - name: F1
140
+ type: f1
141
+ value: 0.8246478873239437
142
+ - name: F1 (macro)
143
+ type: f1_macro
144
+ value: 0.6341826241158882
145
+ - task:
146
+ name: Lexical Relation Classification (EVALution)
147
+ type: classification
148
+ dataset:
149
+ name: BLESS
150
+ args: relbert/lexical_relation_classification
151
+ type: relation-classification
152
+ metrics:
153
+ - name: F1
154
+ type: f1
155
+ value: 0.6419284940411701
156
+ - name: F1 (macro)
157
+ type: f1_macro
158
+ value: 0.6276506974636755
159
+ - task:
160
+ name: Lexical Relation Classification (K&H+N)
161
+ type: classification
162
+ dataset:
163
+ name: K&H+N
164
+ args: relbert/lexical_relation_classification
165
+ type: relation-classification
166
+ metrics:
167
+ - name: F1
168
+ type: f1
169
+ value: 0.9537455658343187
170
+ - name: F1 (macro)
171
+ type: f1_macro
172
+ value: 0.8682095035886689
173
+ - task:
174
+ name: Lexical Relation Classification (ROOT09)
175
+ type: classification
176
+ dataset:
177
+ name: ROOT09
178
+ args: relbert/lexical_relation_classification
179
+ type: relation-classification
180
+ metrics:
181
+ - name: F1
182
+ type: f1
183
+ value: 0.8693199623942337
184
+ - name: F1 (macro)
185
+ type: f1_macro
186
+ value: 0.8626309989847729
187
+
188
+ ---
189
+ # relbert/relbert-roberta-large-nce-e-conceptnet
190
+
191
+ RelBERT based on [roberta-large](https://huggingface.co/roberta-large) fine-tuned on [relbert/conceptnet_relational_similarity](https://huggingface.co/datasets/relbert/conceptnet_relational_similarity) (see the [`relbert`](https://github.com/asahi417/relbert) for more detail of fine-tuning).
192
+ This model achieves the following results on the relation understanding tasks:
193
+ - Analogy Question ([dataset](https://huggingface.co/datasets/relbert/analogy_questions), [full result](https://huggingface.co/relbert/relbert-roberta-large-nce-e-conceptnet/raw/main/analogy.forward.json)):
194
+ - Accuracy on SAT (full): 0.4839572192513369
195
+ - Accuracy on SAT: 0.4688427299703264
196
+ - Accuracy on BATS: 0.6520289049471929
197
+ - Accuracy on U2: 0.4780701754385965
198
+ - Accuracy on U4: 0.5069444444444444
199
+ - Accuracy on Google: 0.776
200
+ - Accuracy on ConceptNet Analogy: 0.3062080536912752
201
+ - Accuracy on T-Rex Analogy: 0.5901639344262295
202
+ - Accuracy on NELL-ONE Analogy: 0.5983333333333334
203
+ - Lexical Relation Classification ([dataset](https://huggingface.co/datasets/relbert/lexical_relation_classification), [full result](https://huggingface.co/relbert/relbert-roberta-large-nce-e-conceptnet/raw/main/classification.json)):
204
+ - Micro F1 score on BLESS: 0.9044749133644719
205
+ - Micro F1 score on CogALexV: 0.8246478873239437
206
+ - Micro F1 score on EVALution: 0.6419284940411701
207
+ - Micro F1 score on K&H+N: 0.9537455658343187
208
+ - Micro F1 score on ROOT09: 0.8693199623942337
209
+ - Relation Mapping ([dataset](https://huggingface.co/datasets/relbert/relation_mapping), [full result](https://huggingface.co/relbert/relbert-roberta-large-nce-e-conceptnet/raw/main/relation_mapping.json)):
210
+ - Accuracy on Relation Mapping: 0.702936507936508
211
+
212
+
213
+ ### Usage
214
+ This model can be used through the [relbert library](https://github.com/asahi417/relbert). Install the library via pip
215
+ ```shell
216
+ pip install relbert
217
+ ```
218
+ and activate model as below.
219
+ ```python
220
+ from relbert import RelBERT
221
+ model = RelBERT("relbert/relbert-roberta-large-nce-e-conceptnet")
222
+ vector = model.get_embedding(['Tokyo', 'Japan']) # shape of (n_dim, )
223
+ ```
224
+
225
+ ### Training hyperparameters
226
+
227
+ - model: roberta-large
228
+ - max_length: 64
229
+ - epoch: 10
230
+ - batch: 16
231
+ - random_seed: 0
232
+ - lr: 5e-06
233
+ - lr_warmup: 10
234
+ - aggregation_mode: average_no_mask
235
+ - data: relbert/conceptnet_relational_similarity
236
+ - data_name: None
237
+ - exclude_relation: None
238
+ - split: train
239
+ - split_valid: validation
240
+ - loss_function: nce
241
+ - classification_loss: False
242
+ - loss_function_config: {'temperature': 0.05, 'num_negative': 300, 'num_positive': 10}
243
+ - augment_negative_by_positive: True
244
+
245
+ See the full configuration at [config file](https://huggingface.co/relbert/relbert-roberta-large-nce-e-conceptnet/raw/main/finetuning_config.json).
246
+
247
+ ### Reference
248
+ If you use any resource from RelBERT, please consider to cite our [paper](https://aclanthology.org/2021.emnlp-main.712/).
249
+
250
+ ```
251
+
252
+ @inproceedings{ushio-etal-2021-distilling,
253
+ title = "Distilling Relation Embeddings from Pretrained Language Models",
254
+ author = "Ushio, Asahi and
255
+ Camacho-Collados, Jose and
256
+ Schockaert, Steven",
257
+ booktitle = "Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing",
258
+ month = nov,
259
+ year = "2021",
260
+ address = "Online and Punta Cana, Dominican Republic",
261
+ publisher = "Association for Computational Linguistics",
262
+ url = "https://aclanthology.org/2021.emnlp-main.712",
263
+ doi = "10.18653/v1/2021.emnlp-main.712",
264
+ pages = "9044--9062",
265
+ abstract = "Pre-trained language models have been found to capture a surprisingly rich amount of lexical knowledge, ranging from commonsense properties of everyday concepts to detailed factual knowledge about named entities. Among others, this makes it possible to distill high-quality word vectors from pre-trained language models. However, it is currently unclear to what extent it is possible to distill relation embeddings, i.e. vectors that characterize the relationship between two words. Such relation embeddings are appealing because they can, in principle, encode relational knowledge in a more fine-grained way than is possible with knowledge graphs. To obtain relation embeddings from a pre-trained language model, we encode word pairs using a (manually or automatically generated) prompt, and we fine-tune the language model such that relationally similar word pairs yield similar output vectors. We find that the resulting relation embeddings are highly competitive on analogy (unsupervised) and relation classification (supervised) benchmarks, even without any task-specific fine-tuning. Source code to reproduce our experimental results and the model checkpoints are available in the following repository: https://github.com/asahi417/relbert",
266
+ }
267
+
268
+ ```
analogy.bidirection.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"sat_full/test": 0.5053475935828877, "sat/test": 0.5103857566765578, "u2/test": 0.4868421052631579, "u4/test": 0.5277777777777778, "google/test": 0.792, "bats/test": 0.6503613118399111, "t_rex_relational_similarity/test": 0.6721311475409836, "conceptnet_relational_similarity/test": 0.27768456375838924, "sat/validation": 0.4594594594594595, "u2/validation": 0.4166666666666667, "u4/validation": 0.5, "google/validation": 0.84, "bats/validation": 0.678391959798995, "semeval2012_relational_similarity/validation": 0.5316455696202531, "t_rex_relational_similarity/validation": 0.2963709677419355, "conceptnet_relational_similarity/validation": 0.21402877697841727, "nell_relational_similarity/test": 0.6516666666666666, "nell_relational_similarity/validation": 0.5975}
analogy.forward.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"conceptnet_relational_similarity/validation": 0.2131294964028777, "sat_full/test": 0.4839572192513369, "sat/test": 0.4688427299703264, "u2/test": 0.4780701754385965, "u4/test": 0.5069444444444444, "google/test": 0.776, "bats/test": 0.6520289049471929, "t_rex_relational_similarity/test": 0.5901639344262295, "conceptnet_relational_similarity/test": 0.3062080536912752, "sat/validation": 0.6216216216216216, "u2/validation": 0.5, "u4/validation": 0.5208333333333334, "google/validation": 0.72, "bats/validation": 0.6934673366834171, "semeval2012_relational_similarity/validation": 0.569620253164557, "t_rex_relational_similarity/validation": 0.2721774193548387, "nell_relational_similarity/test": 0.5983333333333334, "nell_relational_similarity/validation": 0.5775}
analogy.reverse.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"sat_full/test": 0.48128342245989303, "sat/test": 0.4836795252225519, "u2/test": 0.44298245614035087, "u4/test": 0.4861111111111111, "google/test": 0.744, "bats/test": 0.5508615897720957, "t_rex_relational_similarity/test": 0.6010928961748634, "conceptnet_relational_similarity/test": 0.19966442953020133, "sat/validation": 0.4594594594594595, "u2/validation": 0.2916666666666667, "u4/validation": 0.4583333333333333, "google/validation": 0.82, "bats/validation": 0.6130653266331658, "semeval2012_relational_similarity/validation": 0.5443037974683544, "t_rex_relational_similarity/validation": 0.23588709677419356, "conceptnet_relational_similarity/validation": 0.13309352517985612, "nell_relational_similarity/test": 0.6266666666666667, "nell_relational_similarity/validation": 0.5075}
classification.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"lexical_relation_classification/BLESS": {"classifier_config": {"activation": "relu", "alpha": 0.0001, "batch_size": "auto", "beta_1": 0.9, "beta_2": 0.999, "early_stopping": false, "epsilon": 1e-08, "hidden_layer_sizes": [100], "learning_rate": "constant", "learning_rate_init": 0.001, "max_fun": 15000, "max_iter": 200, "momentum": 0.9, "n_iter_no_change": 10, "nesterovs_momentum": true, "power_t": 0.5, "random_state": 0, "shuffle": true, "solver": "adam", "tol": 0.0001, "validation_fraction": 0.1, "verbose": false, "warm_start": false}, "test/accuracy": 0.9044749133644719, "test/f1_macro": 0.9003690113361701, "test/f1_micro": 0.9044749133644719, "test/p_macro": 0.8981803284444059, "test/p_micro": 0.9044749133644719, "test/r_macro": 0.9030048126741151, "test/r_micro": 0.9044749133644719}, "lexical_relation_classification/CogALexV": {"classifier_config": {"activation": "relu", "alpha": 0.0001, "batch_size": "auto", "beta_1": 0.9, "beta_2": 0.999, "early_stopping": false, "epsilon": 1e-08, "hidden_layer_sizes": [100], "learning_rate": "constant", "learning_rate_init": 0.001, "max_fun": 15000, "max_iter": 200, "momentum": 0.9, "n_iter_no_change": 10, "nesterovs_momentum": true, "power_t": 0.5, "random_state": 0, "shuffle": true, "solver": "adam", "tol": 0.0001, "validation_fraction": 0.1, "verbose": false, "warm_start": false}, "test/accuracy": 0.8246478873239437, "test/f1_macro": 0.6341826241158882, "test/f1_micro": 0.8246478873239437, "test/p_macro": 0.6489060621940029, "test/p_micro": 0.8246478873239437, "test/r_macro": 0.6236675650220571, "test/r_micro": 0.8246478873239437}, "lexical_relation_classification/EVALution": {"classifier_config": {"activation": "relu", "alpha": 0.0001, "batch_size": "auto", "beta_1": 0.9, "beta_2": 0.999, "early_stopping": false, "epsilon": 1e-08, "hidden_layer_sizes": [100], "learning_rate": "constant", "learning_rate_init": 0.001, "max_fun": 15000, "max_iter": 200, "momentum": 0.9, "n_iter_no_change": 10, "nesterovs_momentum": true, "power_t": 0.5, "random_state": 0, "shuffle": true, "solver": "adam", "tol": 0.0001, "validation_fraction": 0.1, "verbose": false, "warm_start": false}, "test/accuracy": 0.6419284940411701, "test/f1_macro": 0.6276506974636755, "test/f1_micro": 0.6419284940411701, "test/p_macro": 0.6332938871949486, "test/p_micro": 0.6419284940411701, "test/r_macro": 0.6289572524602296, "test/r_micro": 0.6419284940411701}, "lexical_relation_classification/K&H+N": {"classifier_config": {"activation": "relu", "alpha": 0.0001, "batch_size": "auto", "beta_1": 0.9, "beta_2": 0.999, "early_stopping": false, "epsilon": 1e-08, "hidden_layer_sizes": [100], "learning_rate": "constant", "learning_rate_init": 0.001, "max_fun": 15000, "max_iter": 200, "momentum": 0.9, "n_iter_no_change": 10, "nesterovs_momentum": true, "power_t": 0.5, "random_state": 0, "shuffle": true, "solver": "adam", "tol": 0.0001, "validation_fraction": 0.1, "verbose": false, "warm_start": false}, "test/accuracy": 0.9537455658343187, "test/f1_macro": 0.8682095035886689, "test/f1_micro": 0.9537455658343187, "test/p_macro": 0.8626537196051246, "test/p_micro": 0.9537455658343187, "test/r_macro": 0.8756866317330539, "test/r_micro": 0.9537455658343187}, "lexical_relation_classification/ROOT09": {"classifier_config": {"activation": "relu", "alpha": 0.0001, "batch_size": "auto", "beta_1": 0.9, "beta_2": 0.999, "early_stopping": false, "epsilon": 1e-08, "hidden_layer_sizes": [100], "learning_rate": "constant", "learning_rate_init": 0.001, "max_fun": 15000, "max_iter": 200, "momentum": 0.9, "n_iter_no_change": 10, "nesterovs_momentum": true, "power_t": 0.5, "random_state": 0, "shuffle": true, "solver": "adam", "tol": 0.0001, "validation_fraction": 0.1, "verbose": false, "warm_start": false}, "test/accuracy": 0.8693199623942338, "test/f1_macro": 0.8626309989847729, "test/f1_micro": 0.8693199623942337, "test/p_macro": 0.875391695752107, "test/p_micro": 0.8693199623942338, "test/r_macro": 0.8540001988652377, "test/r_micro": 0.8693199623942338}}
config.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "_name_or_path": "relbert_output/ckpt/nce_conceptnet/template-e/model",
3
  "architectures": [
4
  "RobertaModel"
5
  ],
 
1
  {
2
+ "_name_or_path": "roberta-large",
3
  "architectures": [
4
  "RobertaModel"
5
  ],
finetuning_config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "template": "I wasn\u2019t aware of this relationship, but I just read in the encyclopedia that <obj> is <subj>\u2019s <mask>",
3
+ "model": "roberta-large",
4
+ "max_length": 64,
5
+ "epoch": 10,
6
+ "batch": 16,
7
+ "random_seed": 0,
8
+ "lr": 5e-06,
9
+ "lr_warmup": 10,
10
+ "aggregation_mode": "average_no_mask",
11
+ "data": "relbert/conceptnet_relational_similarity",
12
+ "data_name": null,
13
+ "exclude_relation": null,
14
+ "split": "train",
15
+ "split_valid": "validation",
16
+ "loss_function": "nce",
17
+ "classification_loss": false,
18
+ "loss_function_config": {
19
+ "temperature": 0.05,
20
+ "num_negative": 300,
21
+ "num_positive": 10
22
+ },
23
+ "augment_negative_by_positive": true
24
+ }
relation_mapping.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json CHANGED
@@ -6,7 +6,7 @@
6
  "errors": "replace",
7
  "mask_token": "<mask>",
8
  "model_max_length": 512,
9
- "name_or_path": "relbert_output/ckpt/nce_conceptnet/template-e/model",
10
  "pad_token": "<pad>",
11
  "sep_token": "</s>",
12
  "special_tokens_map_file": null,
 
6
  "errors": "replace",
7
  "mask_token": "<mask>",
8
  "model_max_length": 512,
9
+ "name_or_path": "roberta-large",
10
  "pad_token": "<pad>",
11
  "sep_token": "</s>",
12
  "special_tokens_map_file": null,