evalscope 0.5.5rc0__py3-none-any.whl → 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of evalscope might be problematic. Click here for more details.
- evalscope/backend/__init__.py +0 -3
- evalscope/backend/opencompass/tasks/eval_datasets.py +1 -1
- evalscope/backend/rag_eval/__init__.py +4 -0
- evalscope/backend/rag_eval/backend_manager.py +80 -0
- evalscope/backend/rag_eval/clip_benchmark/__init__.py +2 -0
- evalscope/backend/rag_eval/clip_benchmark/arguments.py +34 -0
- evalscope/backend/rag_eval/clip_benchmark/dataset_builder.py +277 -0
- evalscope/backend/rag_eval/clip_benchmark/task_template.py +119 -0
- evalscope/backend/rag_eval/clip_benchmark/tasks/__init__.py +0 -0
- evalscope/backend/rag_eval/clip_benchmark/tasks/image_caption.py +83 -0
- evalscope/backend/rag_eval/clip_benchmark/tasks/zeroshot_classification.py +247 -0
- evalscope/backend/rag_eval/clip_benchmark/tasks/zeroshot_retrieval.py +170 -0
- evalscope/backend/rag_eval/cmteb/__init__.py +4 -0
- evalscope/backend/rag_eval/cmteb/arguments.py +61 -0
- evalscope/backend/rag_eval/cmteb/base.py +91 -0
- evalscope/backend/rag_eval/cmteb/task_template.py +85 -0
- evalscope/backend/rag_eval/cmteb/tasks/Classification.py +302 -0
- evalscope/backend/rag_eval/cmteb/tasks/Clustering.py +252 -0
- evalscope/backend/rag_eval/cmteb/tasks/CustomTask.py +61 -0
- evalscope/backend/rag_eval/cmteb/tasks/PairClassification.py +113 -0
- evalscope/backend/rag_eval/cmteb/tasks/Reranking.py +151 -0
- evalscope/backend/rag_eval/cmteb/tasks/Retrieval.py +345 -0
- evalscope/backend/rag_eval/cmteb/tasks/STS.py +302 -0
- evalscope/backend/rag_eval/cmteb/tasks/__init__.py +70 -0
- evalscope/backend/rag_eval/ragas/__init__.py +2 -0
- evalscope/backend/rag_eval/ragas/arguments.py +47 -0
- evalscope/backend/rag_eval/ragas/metrics/__init__.py +2 -0
- evalscope/backend/rag_eval/ragas/metrics/multi_modal_faithfulness.py +91 -0
- evalscope/backend/rag_eval/ragas/metrics/multi_modal_relevance.py +99 -0
- evalscope/backend/rag_eval/ragas/task_template.py +61 -0
- evalscope/backend/rag_eval/ragas/tasks/__init__.py +2 -0
- evalscope/backend/rag_eval/ragas/tasks/testset_generation.py +263 -0
- evalscope/backend/rag_eval/ragas/tasks/translate_prompt.py +72 -0
- evalscope/backend/vlm_eval_kit/backend_manager.py +0 -1
- evalscope/backend/vlm_eval_kit/custom_dataset.py +1 -1
- evalscope/evaluator/evaluator.py +1 -0
- evalscope/metrics/bundled_rouge_score/rouge_scorer.py +19 -0
- evalscope/models/api/openai_api.py +2 -2
- evalscope/perf/http_client.py +1 -1
- evalscope/perf/openai_api.py +2 -0
- evalscope/run.py +4 -0
- evalscope/utils/logger.py +44 -14
- evalscope/utils/task_utils.py +3 -0
- evalscope/version.py +2 -2
- {evalscope-0.5.5rc0.dist-info → evalscope-0.6.0.dist-info}/METADATA +95 -99
- {evalscope-0.5.5rc0.dist-info → evalscope-0.6.0.dist-info}/RECORD +49 -18
- {evalscope-0.5.5rc0.dist-info → evalscope-0.6.0.dist-info}/WHEEL +1 -1
- {evalscope-0.5.5rc0.dist-info → evalscope-0.6.0.dist-info}/entry_points.txt +0 -0
- {evalscope-0.5.5rc0.dist-info → evalscope-0.6.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
from mteb.abstasks.AbsTaskClassification import AbsTaskClassification
|
|
2
|
+
from mteb.abstasks.TaskMetadata import TaskMetadata
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class TNews(AbsTaskClassification):
|
|
6
|
+
metadata = TaskMetadata(
|
|
7
|
+
name="TNews",
|
|
8
|
+
description="Short Text Classification for News",
|
|
9
|
+
reference="https://www.cluebenchmarks.com/introduce.html",
|
|
10
|
+
dataset={
|
|
11
|
+
"path": "C-MTEB/TNews-classification",
|
|
12
|
+
"revision": "317f262bf1e6126357bbe89e875451e4b0938fe4",
|
|
13
|
+
},
|
|
14
|
+
type="Classification",
|
|
15
|
+
category="s2s",
|
|
16
|
+
modalities=["text"],
|
|
17
|
+
eval_splits=["validation"],
|
|
18
|
+
eval_langs=["cmn-Hans"],
|
|
19
|
+
main_score="accuracy",
|
|
20
|
+
date=None,
|
|
21
|
+
domains=None,
|
|
22
|
+
task_subtypes=None,
|
|
23
|
+
license=None,
|
|
24
|
+
annotations_creators=None,
|
|
25
|
+
dialect=None,
|
|
26
|
+
sample_creation=None,
|
|
27
|
+
bibtex_citation="""@inproceedings {xu-etal-2020-clue,
|
|
28
|
+
title = "{CLUE}: A {C}hinese Language Understanding Evaluation Benchmark",
|
|
29
|
+
author = "Xu, Liang and
|
|
30
|
+
Hu, Hai and
|
|
31
|
+
Zhang, Xuanwei and
|
|
32
|
+
Li, Lu and
|
|
33
|
+
Cao, Chenjie and
|
|
34
|
+
Li, Yudong and
|
|
35
|
+
Xu, Yechen and
|
|
36
|
+
Sun, Kai and
|
|
37
|
+
Yu, Dian and
|
|
38
|
+
Yu, Cong and
|
|
39
|
+
Tian, Yin and
|
|
40
|
+
Dong, Qianqian and
|
|
41
|
+
Liu, Weitang and
|
|
42
|
+
Shi, Bo and
|
|
43
|
+
Cui, Yiming and
|
|
44
|
+
Li, Junyi and
|
|
45
|
+
Zeng, Jun and
|
|
46
|
+
Wang, Rongzhao and
|
|
47
|
+
Xie, Weijian and
|
|
48
|
+
Li, Yanting and
|
|
49
|
+
Patterson, Yina and
|
|
50
|
+
Tian, Zuoyu and
|
|
51
|
+
Zhang, Yiwen and
|
|
52
|
+
Zhou, He and
|
|
53
|
+
Liu, Shaoweihua and
|
|
54
|
+
Zhao, Zhe and
|
|
55
|
+
Zhao, Qipeng and
|
|
56
|
+
Yue, Cong and
|
|
57
|
+
Zhang, Xinrui and
|
|
58
|
+
Yang, Zhengliang and
|
|
59
|
+
Richardson, Kyle and
|
|
60
|
+
Lan, Zhenzhong ",
|
|
61
|
+
booktitle = "Proceedings of the 28th International Conference on Computational Linguistics",
|
|
62
|
+
month = dec,
|
|
63
|
+
year = "2020",
|
|
64
|
+
address = "Barcelona, Spain (Online)",
|
|
65
|
+
publisher = "International Committee on Computational Linguistics",
|
|
66
|
+
url = "https://aclanthology.org/2020.coling-main.419",
|
|
67
|
+
doi = "10.18653/v1/2020.coling-main.419",
|
|
68
|
+
pages = "4762--4772",
|
|
69
|
+
}""",
|
|
70
|
+
descriptive_stats={"n_samples": None, "avg_character_length": None},
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
@property
|
|
74
|
+
def metadata_dict(self) -> dict[str, str]:
|
|
75
|
+
metadata_dict = super().metadata_dict
|
|
76
|
+
metadata_dict["samples_per_label"] = 32
|
|
77
|
+
return metadata_dict
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class IFlyTek(AbsTaskClassification):
|
|
81
|
+
metadata = TaskMetadata(
|
|
82
|
+
name="IFlyTek",
|
|
83
|
+
description="Long Text classification for the description of Apps",
|
|
84
|
+
reference="https://www.cluebenchmarks.com/introduce.html",
|
|
85
|
+
dataset={
|
|
86
|
+
"path": "C-MTEB/IFlyTek-classification",
|
|
87
|
+
"revision": "421605374b29664c5fc098418fe20ada9bd55f8a",
|
|
88
|
+
},
|
|
89
|
+
type="Classification",
|
|
90
|
+
category="s2s",
|
|
91
|
+
modalities=["text"],
|
|
92
|
+
eval_splits=["validation"],
|
|
93
|
+
eval_langs=["cmn-Hans"],
|
|
94
|
+
main_score="accuracy",
|
|
95
|
+
date=None,
|
|
96
|
+
domains=None,
|
|
97
|
+
task_subtypes=None,
|
|
98
|
+
license=None,
|
|
99
|
+
annotations_creators=None,
|
|
100
|
+
dialect=None,
|
|
101
|
+
sample_creation=None,
|
|
102
|
+
bibtex_citation="""@inproceedings {xu-etal-2020-clue,
|
|
103
|
+
title = "{CLUE}: A {C}hinese Language Understanding Evaluation Benchmark",
|
|
104
|
+
author = "Xu, Liang and
|
|
105
|
+
Hu, Hai and
|
|
106
|
+
Zhang, Xuanwei and
|
|
107
|
+
Li, Lu and
|
|
108
|
+
Cao, Chenjie and
|
|
109
|
+
Li, Yudong and
|
|
110
|
+
Xu, Yechen and
|
|
111
|
+
Sun, Kai and
|
|
112
|
+
Yu, Dian and
|
|
113
|
+
Yu, Cong and
|
|
114
|
+
Tian, Yin and
|
|
115
|
+
Dong, Qianqian and
|
|
116
|
+
Liu, Weitang and
|
|
117
|
+
Shi, Bo and
|
|
118
|
+
Cui, Yiming and
|
|
119
|
+
Li, Junyi and
|
|
120
|
+
Zeng, Jun and
|
|
121
|
+
Wang, Rongzhao and
|
|
122
|
+
Xie, Weijian and
|
|
123
|
+
Li, Yanting and
|
|
124
|
+
Patterson, Yina and
|
|
125
|
+
Tian, Zuoyu and
|
|
126
|
+
Zhang, Yiwen and
|
|
127
|
+
Zhou, He and
|
|
128
|
+
Liu, Shaoweihua and
|
|
129
|
+
Zhao, Zhe and
|
|
130
|
+
Zhao, Qipeng and
|
|
131
|
+
Yue, Cong and
|
|
132
|
+
Zhang, Xinrui and
|
|
133
|
+
Yang, Zhengliang and
|
|
134
|
+
Richardson, Kyle and
|
|
135
|
+
Lan, Zhenzhong ",
|
|
136
|
+
booktitle = "Proceedings of the 28th International Conference on Computational Linguistics",
|
|
137
|
+
month = dec,
|
|
138
|
+
year = "2020",
|
|
139
|
+
address = "Barcelona, Spain (Online)",
|
|
140
|
+
publisher = "International Committee on Computational Linguistics",
|
|
141
|
+
url = "https://aclanthology.org/2020.coling-main.419",
|
|
142
|
+
doi = "10.18653/v1/2020.coling-main.419",
|
|
143
|
+
pages = "4762--4772",
|
|
144
|
+
abstract = "The advent of natural language understanding (NLU) benchmarks for English, such as GLUE and SuperGLUE allows new NLU models to be evaluated across a diverse set of tasks. These comprehensive benchmarks have facilitated a broad range of research and applications in natural language processing (NLP). The problem, however, is that most such benchmarks are limited to English, which has made it difficult to replicate many of the successes in English NLU for other languages. To help remedy this issue, we introduce the first large-scale Chinese Language Understanding Evaluation (CLUE) benchmark. CLUE is an open-ended, community-driven project that brings together 9 tasks spanning several well-established single-sentence/sentence-pair classification tasks, as well as machine reading comprehension, all on original Chinese text. To establish results on these tasks, we report scores using an exhaustive set of current state-of-the-art pre-trained Chinese models (9 in total). We also introduce a number of supplementary datasets and additional tools to help facilitate further progress on Chinese NLU. Our benchmark is released at https://www.cluebenchmarks.com",
|
|
145
|
+
}""",
|
|
146
|
+
descriptive_stats={"n_samples": None, "avg_character_length": None},
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
@property
|
|
150
|
+
def metadata_dict(self) -> dict[str, str]:
|
|
151
|
+
metadata_dict = super().metadata_dict
|
|
152
|
+
metadata_dict["samples_per_label"] = 32
|
|
153
|
+
metadata_dict["n_experiments"] = 5
|
|
154
|
+
return metadata_dict
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
class MultilingualSentiment(AbsTaskClassification):
|
|
158
|
+
metadata = TaskMetadata(
|
|
159
|
+
name="MultilingualSentiment",
|
|
160
|
+
description="A collection of multilingual sentiments datasets grouped into 3 classes -- positive, neutral, negative",
|
|
161
|
+
reference="https://github.com/tyqiangz/multilingual-sentiment-datasets",
|
|
162
|
+
dataset={
|
|
163
|
+
"path": "C-MTEB/MultilingualSentiment-classification",
|
|
164
|
+
"revision": "46958b007a63fdbf239b7672c25d0bea67b5ea1a",
|
|
165
|
+
},
|
|
166
|
+
type="Classification",
|
|
167
|
+
category="s2s",
|
|
168
|
+
modalities=["text"],
|
|
169
|
+
eval_splits=["validation", "test"],
|
|
170
|
+
eval_langs=["cmn-Hans"],
|
|
171
|
+
main_score="accuracy",
|
|
172
|
+
date=None,
|
|
173
|
+
domains=None,
|
|
174
|
+
task_subtypes=None,
|
|
175
|
+
license=None,
|
|
176
|
+
annotations_creators=None,
|
|
177
|
+
dialect=None,
|
|
178
|
+
sample_creation=None,
|
|
179
|
+
bibtex_citation=None,
|
|
180
|
+
descriptive_stats={"n_samples": None, "avg_character_length": None},
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
@property
|
|
184
|
+
def metadata_dict(self) -> dict[str, str]:
|
|
185
|
+
metadata_dict = super().metadata_dict
|
|
186
|
+
metadata_dict["samples_per_label"] = 32
|
|
187
|
+
return metadata_dict
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class JDReview(AbsTaskClassification):
|
|
191
|
+
metadata = TaskMetadata(
|
|
192
|
+
name="JDReview",
|
|
193
|
+
description="review for iphone",
|
|
194
|
+
reference="https://aclanthology.org/2023.nodalida-1.20/",
|
|
195
|
+
dataset={
|
|
196
|
+
"path": "C-MTEB/JDReview-classification",
|
|
197
|
+
"revision": "b7c64bd89eb87f8ded463478346f76731f07bf8b",
|
|
198
|
+
},
|
|
199
|
+
type="Classification",
|
|
200
|
+
category="s2s",
|
|
201
|
+
modalities=["text"],
|
|
202
|
+
eval_splits=["test"],
|
|
203
|
+
eval_langs=["cmn-Hans"],
|
|
204
|
+
main_score="accuracy",
|
|
205
|
+
date=None,
|
|
206
|
+
domains=None,
|
|
207
|
+
task_subtypes=None,
|
|
208
|
+
license=None,
|
|
209
|
+
annotations_creators=None,
|
|
210
|
+
dialect=None,
|
|
211
|
+
sample_creation=None,
|
|
212
|
+
bibtex_citation="""@article{xiao2023c,
|
|
213
|
+
title={C-pack: Packaged resources to advance general chinese embedding},
|
|
214
|
+
author={Xiao, Shitao and Liu, Zheng and Zhang, Peitian and Muennighof, Niklas},
|
|
215
|
+
journal={arXiv preprint arXiv:2309.07597},
|
|
216
|
+
year={2023}
|
|
217
|
+
}""",
|
|
218
|
+
descriptive_stats={"n_samples": None, "avg_character_length": None},
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
@property
|
|
222
|
+
def metadata_dict(self) -> dict[str, str]:
|
|
223
|
+
metadata_dict = super().metadata_dict
|
|
224
|
+
metadata_dict["samples_per_label"] = 32
|
|
225
|
+
return metadata_dict
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
class OnlineShopping(AbsTaskClassification):
|
|
229
|
+
metadata = TaskMetadata(
|
|
230
|
+
name="OnlineShopping",
|
|
231
|
+
description="Sentiment Analysis of User Reviews on Online Shopping Websites",
|
|
232
|
+
reference="https://aclanthology.org/2023.nodalida-1.20/",
|
|
233
|
+
dataset={
|
|
234
|
+
"path": "C-MTEB/OnlineShopping-classification",
|
|
235
|
+
"revision": "e610f2ebd179a8fda30ae534c3878750a96db120",
|
|
236
|
+
},
|
|
237
|
+
type="Classification",
|
|
238
|
+
category="s2s",
|
|
239
|
+
modalities=["text"],
|
|
240
|
+
eval_splits=["test"],
|
|
241
|
+
eval_langs=["cmn-Hans"],
|
|
242
|
+
main_score="accuracy",
|
|
243
|
+
date=None,
|
|
244
|
+
domains=None,
|
|
245
|
+
task_subtypes=None,
|
|
246
|
+
license=None,
|
|
247
|
+
annotations_creators=None,
|
|
248
|
+
dialect=None,
|
|
249
|
+
sample_creation=None,
|
|
250
|
+
bibtex_citation="""@article{xiao2023c,
|
|
251
|
+
title={C-pack: Packaged resources to advance general chinese embedding},
|
|
252
|
+
author={Xiao, Shitao and Liu, Zheng and Zhang, Peitian and Muennighof, Niklas},
|
|
253
|
+
journal={arXiv preprint arXiv:2309.07597},
|
|
254
|
+
year={2023}
|
|
255
|
+
}""",
|
|
256
|
+
descriptive_stats={"n_samples": None, "avg_character_length": None},
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
@property
|
|
260
|
+
def metadata_dict(self) -> dict[str, str]:
|
|
261
|
+
metadata_dict = super().metadata_dict
|
|
262
|
+
metadata_dict["samples_per_label"] = 32
|
|
263
|
+
return metadata_dict
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
class Waimai(AbsTaskClassification):
|
|
267
|
+
metadata = TaskMetadata(
|
|
268
|
+
name="Waimai",
|
|
269
|
+
description="Sentiment Analysis of user reviews on takeaway platforms",
|
|
270
|
+
reference="https://aclanthology.org/2023.nodalida-1.20/",
|
|
271
|
+
dataset={
|
|
272
|
+
"path": "C-MTEB/waimai-classification",
|
|
273
|
+
"revision": "339287def212450dcaa9df8c22bf93e9980c7023",
|
|
274
|
+
},
|
|
275
|
+
type="Classification",
|
|
276
|
+
category="s2s",
|
|
277
|
+
modalities=["text"],
|
|
278
|
+
eval_splits=["test"],
|
|
279
|
+
eval_langs=["cmn-Hans"],
|
|
280
|
+
main_score="accuracy",
|
|
281
|
+
date=None,
|
|
282
|
+
domains=None,
|
|
283
|
+
task_subtypes=None,
|
|
284
|
+
license=None,
|
|
285
|
+
annotations_creators=None,
|
|
286
|
+
dialect=None,
|
|
287
|
+
sample_creation=None,
|
|
288
|
+
bibtex_citation="""@article{xiao2023c,
|
|
289
|
+
title={C-pack: Packaged resources to advance general chinese embedding},
|
|
290
|
+
author={Xiao, Shitao and Liu, Zheng and Zhang, Peitian and Muennighof, Niklas},
|
|
291
|
+
journal={arXiv preprint arXiv:2309.07597},
|
|
292
|
+
year={2023}
|
|
293
|
+
}""",
|
|
294
|
+
descriptive_stats={"n_samples": None, "avg_character_length": None},
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
@property
|
|
298
|
+
def metadata_dict(self) -> dict[str, str]:
|
|
299
|
+
metadata_dict = super().metadata_dict
|
|
300
|
+
metadata_dict["samples_per_label"] = 32
|
|
301
|
+
|
|
302
|
+
return metadata_dict
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import itertools
|
|
2
|
+
|
|
3
|
+
from datasets import Dataset, DatasetDict
|
|
4
|
+
|
|
5
|
+
from mteb.abstasks.AbsTaskClustering import AbsTaskClustering
|
|
6
|
+
from mteb.abstasks.AbsTaskClusteringFast import (
|
|
7
|
+
AbsTaskClusteringFast,
|
|
8
|
+
check_label_distribution,
|
|
9
|
+
)
|
|
10
|
+
from mteb.abstasks.TaskMetadata import TaskMetadata
|
|
11
|
+
|
|
12
|
+
NUM_SAMPLES = 2048
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class CLSClusteringFastS2S(AbsTaskClusteringFast):
|
|
16
|
+
max_document_to_embed = NUM_SAMPLES
|
|
17
|
+
max_fraction_of_documents_to_embed = None
|
|
18
|
+
|
|
19
|
+
metadata = TaskMetadata(
|
|
20
|
+
name="CLSClusteringS2S",
|
|
21
|
+
description="Clustering of titles from CLS dataset. Clustering of 13 sets on the main category.",
|
|
22
|
+
reference="https://arxiv.org/abs/2209.05034",
|
|
23
|
+
dataset={
|
|
24
|
+
"path": "C-MTEB/CLSClusteringS2S",
|
|
25
|
+
"revision": "e458b3f5414b62b7f9f83499ac1f5497ae2e869f",
|
|
26
|
+
},
|
|
27
|
+
type="Clustering",
|
|
28
|
+
category="s2s",
|
|
29
|
+
modalities=["text"],
|
|
30
|
+
eval_splits=["test"],
|
|
31
|
+
eval_langs=["cmn-Hans"],
|
|
32
|
+
main_score="v_measure",
|
|
33
|
+
date=("2022-01-01", "2022-09-12"),
|
|
34
|
+
domains=["Academic", "Written"],
|
|
35
|
+
task_subtypes=["Thematic clustering", "Topic classification"],
|
|
36
|
+
license="Apache-2.0",
|
|
37
|
+
annotations_creators="derived",
|
|
38
|
+
dialect=[],
|
|
39
|
+
sample_creation="found",
|
|
40
|
+
bibtex_citation="""@misc{li2022csl,
|
|
41
|
+
title={CSL: A Large-scale Chinese Scientific Literature Dataset},
|
|
42
|
+
author={Yudong Li and Yuqing Zhang and Zhe Zhao and Linlin Shen and Weijie Liu and Weiquan Mao and Hui Zhang},
|
|
43
|
+
year={2022},
|
|
44
|
+
eprint={2209.05034},
|
|
45
|
+
archivePrefix={arXiv},
|
|
46
|
+
primaryClass={cs.CL}
|
|
47
|
+
}""",
|
|
48
|
+
descriptive_stats={
|
|
49
|
+
"n_samples": {"test": NUM_SAMPLES},
|
|
50
|
+
"avg_character_length": {},
|
|
51
|
+
},
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
def dataset_transform(self):
|
|
55
|
+
ds = {}
|
|
56
|
+
for split in self.metadata.eval_splits:
|
|
57
|
+
labels = list(itertools.chain.from_iterable(self.dataset[split]["labels"]))
|
|
58
|
+
sentences = list(
|
|
59
|
+
itertools.chain.from_iterable(self.dataset[split]["sentences"])
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
check_label_distribution(self.dataset[split])
|
|
63
|
+
|
|
64
|
+
ds[split] = Dataset.from_dict({"labels": labels, "sentences": sentences})
|
|
65
|
+
self.dataset = DatasetDict(ds)
|
|
66
|
+
self.dataset = self.stratified_subsampling(
|
|
67
|
+
self.dataset,
|
|
68
|
+
self.seed,
|
|
69
|
+
self.metadata.eval_splits,
|
|
70
|
+
label="labels",
|
|
71
|
+
n_samples=NUM_SAMPLES,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class CLSClusteringFastP2P(AbsTaskClusteringFast):
|
|
76
|
+
max_document_to_embed = NUM_SAMPLES
|
|
77
|
+
max_fraction_of_documents_to_embed = None
|
|
78
|
+
|
|
79
|
+
metadata = TaskMetadata(
|
|
80
|
+
name="CLSClusteringP2P",
|
|
81
|
+
description="Clustering of titles + abstract from CLS dataset. Clustering of 13 sets on the main category.",
|
|
82
|
+
reference="https://arxiv.org/abs/2209.05034",
|
|
83
|
+
dataset={
|
|
84
|
+
"path": "C-MTEB/CLSClusteringP2P",
|
|
85
|
+
"revision": "4b6227591c6c1a73bc76b1055f3b7f3588e72476",
|
|
86
|
+
},
|
|
87
|
+
type="Clustering",
|
|
88
|
+
category="p2p",
|
|
89
|
+
modalities=["text"],
|
|
90
|
+
eval_splits=["test"],
|
|
91
|
+
eval_langs=["cmn-Hans"],
|
|
92
|
+
main_score="v_measure",
|
|
93
|
+
date=("2022-01-01", "2022-09-12"),
|
|
94
|
+
domains=["Academic", "Written"],
|
|
95
|
+
task_subtypes=["Thematic clustering", "Topic classification"],
|
|
96
|
+
license="Apache-2.0",
|
|
97
|
+
annotations_creators="derived",
|
|
98
|
+
dialect=[],
|
|
99
|
+
sample_creation="found",
|
|
100
|
+
bibtex_citation="""@misc{li2022csl,
|
|
101
|
+
title={CSL: A Large-scale Chinese Scientific Literature Dataset},
|
|
102
|
+
author={Yudong Li and Yuqing Zhang and Zhe Zhao and Linlin Shen and Weijie Liu and Weiquan Mao and Hui Zhang},
|
|
103
|
+
year={2022},
|
|
104
|
+
eprint={2209.05034},
|
|
105
|
+
archivePrefix={arXiv},
|
|
106
|
+
primaryClass={cs.CL}
|
|
107
|
+
}""",
|
|
108
|
+
descriptive_stats={
|
|
109
|
+
"n_samples": {"test": NUM_SAMPLES},
|
|
110
|
+
"avg_character_length": {},
|
|
111
|
+
},
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
def dataset_transform(self):
|
|
115
|
+
ds = {}
|
|
116
|
+
for split in self.metadata.eval_splits:
|
|
117
|
+
labels = list(itertools.chain.from_iterable(self.dataset[split]["labels"]))
|
|
118
|
+
sentences = list(
|
|
119
|
+
itertools.chain.from_iterable(self.dataset[split]["sentences"])
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
check_label_distribution(self.dataset[split])
|
|
123
|
+
|
|
124
|
+
ds[split] = Dataset.from_dict({"labels": labels, "sentences": sentences})
|
|
125
|
+
self.dataset = DatasetDict(ds)
|
|
126
|
+
self.dataset = self.stratified_subsampling(
|
|
127
|
+
self.dataset,
|
|
128
|
+
self.seed,
|
|
129
|
+
self.metadata.eval_splits,
|
|
130
|
+
label="labels",
|
|
131
|
+
n_samples=NUM_SAMPLES,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class ThuNewsClusteringFastS2S(AbsTaskClusteringFast):
|
|
136
|
+
max_document_to_embed = NUM_SAMPLES
|
|
137
|
+
max_fraction_of_documents_to_embed = None
|
|
138
|
+
|
|
139
|
+
metadata = TaskMetadata(
|
|
140
|
+
name="ThuNewsClusteringS2S",
|
|
141
|
+
dataset={
|
|
142
|
+
"path": "C-MTEB/ThuNewsClusteringS2S",
|
|
143
|
+
"revision": "8a8b2caeda43f39e13c4bc5bea0f8a667896e10d",
|
|
144
|
+
},
|
|
145
|
+
description="Clustering of titles from the THUCNews dataset",
|
|
146
|
+
reference="http://thuctc.thunlp.org/",
|
|
147
|
+
type="Clustering",
|
|
148
|
+
category="s2s",
|
|
149
|
+
modalities=["text"],
|
|
150
|
+
eval_splits=["test"],
|
|
151
|
+
eval_langs=["cmn-Hans"],
|
|
152
|
+
main_score="v_measure",
|
|
153
|
+
date=("2006-01-01", "2007-01-01"),
|
|
154
|
+
domains=["News", "Written"],
|
|
155
|
+
task_subtypes=["Thematic clustering", "Topic classification"],
|
|
156
|
+
license="Not specified",
|
|
157
|
+
annotations_creators="derived",
|
|
158
|
+
dialect=[],
|
|
159
|
+
sample_creation="found",
|
|
160
|
+
bibtex_citation="""@software{THUCTC,
|
|
161
|
+
author = {Sun, M. and Li, J. and Guo, Z. and Yu, Z. and Zheng, Y. and Si, X. and Liu, Z.},
|
|
162
|
+
title = {THUCTC: An Efficient Chinese Text Classifier},
|
|
163
|
+
year = {2016},
|
|
164
|
+
note = {THU Chinese Text Classification Toolkit},
|
|
165
|
+
publisher = {THU Natural Language Processing Lab},
|
|
166
|
+
url = {https://github.com/thunlp/THUCTC}
|
|
167
|
+
}""",
|
|
168
|
+
descriptive_stats={
|
|
169
|
+
"n_samples": {"test": NUM_SAMPLES},
|
|
170
|
+
"avg_character_length": {},
|
|
171
|
+
},
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
def dataset_transform(self):
|
|
175
|
+
ds = {}
|
|
176
|
+
for split in self.metadata.eval_splits:
|
|
177
|
+
labels = list(itertools.chain.from_iterable(self.dataset[split]["labels"]))
|
|
178
|
+
sentences = list(
|
|
179
|
+
itertools.chain.from_iterable(self.dataset[split]["sentences"])
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
check_label_distribution(self.dataset[split])
|
|
183
|
+
|
|
184
|
+
ds[split] = Dataset.from_dict({"labels": labels, "sentences": sentences})
|
|
185
|
+
self.dataset = DatasetDict(ds)
|
|
186
|
+
self.dataset = self.stratified_subsampling(
|
|
187
|
+
self.dataset,
|
|
188
|
+
self.seed,
|
|
189
|
+
self.metadata.eval_splits,
|
|
190
|
+
label="labels",
|
|
191
|
+
n_samples=NUM_SAMPLES,
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
class ThuNewsClusteringFastP2P(AbsTaskClusteringFast):
|
|
196
|
+
max_document_to_embed = NUM_SAMPLES
|
|
197
|
+
max_fraction_of_documents_to_embed = None
|
|
198
|
+
|
|
199
|
+
metadata = TaskMetadata(
|
|
200
|
+
name="ThuNewsClusteringP2P",
|
|
201
|
+
dataset={
|
|
202
|
+
"path": "C-MTEB/ThuNewsClusteringP2P",
|
|
203
|
+
"revision": "5798586b105c0434e4f0fe5e767abe619442cf93",
|
|
204
|
+
},
|
|
205
|
+
description="Clustering of titles + abstracts from the THUCNews dataset",
|
|
206
|
+
reference="http://thuctc.thunlp.org/",
|
|
207
|
+
type="Clustering",
|
|
208
|
+
category="p2p",
|
|
209
|
+
modalities=["text"],
|
|
210
|
+
eval_splits=["test"],
|
|
211
|
+
eval_langs=["cmn-Hans"],
|
|
212
|
+
main_score="v_measure",
|
|
213
|
+
date=("2006-01-01", "2007-01-01"),
|
|
214
|
+
domains=["News", "Written"],
|
|
215
|
+
task_subtypes=["Thematic clustering", "Topic classification"],
|
|
216
|
+
license="Not specified",
|
|
217
|
+
annotations_creators="derived",
|
|
218
|
+
dialect=[],
|
|
219
|
+
sample_creation="found",
|
|
220
|
+
bibtex_citation="""@software{THUCTC,
|
|
221
|
+
author = {Sun, M. and Li, J. and Guo, Z. and Yu, Z. and Zheng, Y. and Si, X. and Liu, Z.},
|
|
222
|
+
title = {THUCTC: An Efficient Chinese Text Classifier},
|
|
223
|
+
year = {2016},
|
|
224
|
+
note = {THU Chinese Text Classification Toolkit},
|
|
225
|
+
publisher = {THU Natural Language Processing Lab},
|
|
226
|
+
url = {https://github.com/thunlp/THUCTC}
|
|
227
|
+
}""",
|
|
228
|
+
descriptive_stats={
|
|
229
|
+
"n_samples": {"test": NUM_SAMPLES},
|
|
230
|
+
"avg_character_length": {},
|
|
231
|
+
},
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
def dataset_transform(self):
|
|
235
|
+
ds = {}
|
|
236
|
+
for split in self.metadata.eval_splits:
|
|
237
|
+
labels = list(itertools.chain.from_iterable(self.dataset[split]["labels"]))
|
|
238
|
+
sentences = list(
|
|
239
|
+
itertools.chain.from_iterable(self.dataset[split]["sentences"])
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
check_label_distribution(self.dataset[split])
|
|
243
|
+
|
|
244
|
+
ds[split] = Dataset.from_dict({"labels": labels, "sentences": sentences})
|
|
245
|
+
self.dataset = DatasetDict(ds)
|
|
246
|
+
self.dataset = self.stratified_subsampling(
|
|
247
|
+
self.dataset,
|
|
248
|
+
self.seed,
|
|
249
|
+
self.metadata.eval_splits,
|
|
250
|
+
label="labels",
|
|
251
|
+
n_samples=NUM_SAMPLES,
|
|
252
|
+
)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
from mteb import AbsTaskRetrieval
|
|
3
|
+
from mteb import HFDataLoader as CustomDataLoader
|
|
4
|
+
from mteb.abstasks.TaskMetadata import TaskMetadata
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class CustomRetrieval(AbsTaskRetrieval):
|
|
8
|
+
metadata: TaskMetadata
|
|
9
|
+
ignore_identical_ids: bool = True
|
|
10
|
+
|
|
11
|
+
def __init__(
|
|
12
|
+
self, dataset_path: Optional[str] = "custom_eval/text/retrieval", **kwargs
|
|
13
|
+
):
|
|
14
|
+
super().__init__(**kwargs)
|
|
15
|
+
self.metadata = TaskMetadata(
|
|
16
|
+
name="CustomRetrieval",
|
|
17
|
+
description="CustomRetrieval Task",
|
|
18
|
+
reference=None,
|
|
19
|
+
dataset={
|
|
20
|
+
"path": dataset_path,
|
|
21
|
+
"revision": "v1",
|
|
22
|
+
},
|
|
23
|
+
type="Retrieval",
|
|
24
|
+
category="s2p",
|
|
25
|
+
modalities=["text"],
|
|
26
|
+
eval_splits=["test"],
|
|
27
|
+
eval_langs=["cmn-Hans"],
|
|
28
|
+
main_score="recall_at_5",
|
|
29
|
+
date=None,
|
|
30
|
+
domains=None,
|
|
31
|
+
task_subtypes=None,
|
|
32
|
+
license=None,
|
|
33
|
+
annotations_creators=None,
|
|
34
|
+
dialect=None,
|
|
35
|
+
sample_creation=None,
|
|
36
|
+
bibtex_citation="",
|
|
37
|
+
descriptive_stats={},
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
def load_data(self, **kwargs):
|
|
41
|
+
if self.data_loaded:
|
|
42
|
+
return
|
|
43
|
+
self.corpus, self.queries, self.relevant_docs = {}, {}, {}
|
|
44
|
+
dataset_path = self.metadata_dict["dataset"]["path"]
|
|
45
|
+
|
|
46
|
+
for split in kwargs.get("eval_splits", self.metadata_dict["eval_splits"]):
|
|
47
|
+
corpus, queries, qrels = CustomDataLoader(
|
|
48
|
+
data_folder=dataset_path,
|
|
49
|
+
streaming=False,
|
|
50
|
+
keep_in_memory=False,
|
|
51
|
+
).load(split=split)
|
|
52
|
+
# Conversion from DataSet
|
|
53
|
+
queries = {query["id"]: query["text"] for query in queries}
|
|
54
|
+
corpus = {doc["id"]: {"text": doc["text"]} for doc in corpus}
|
|
55
|
+
self.corpus[split], self.queries[split], self.relevant_docs[split] = (
|
|
56
|
+
corpus,
|
|
57
|
+
queries,
|
|
58
|
+
qrels,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
self.data_loaded = True
|