xiaowenbin commited on
Commit
dc25e36
1 Parent(s): d92aead

Upload mteb_eval.py

Browse files
Files changed (1) hide show
  1. mteb_eval.py +18 -0
mteb_eval.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ import functools
3
+ from mteb import MTEB
4
+ from sentence_transformers import SentenceTransformer
5
+ logging.basicConfig(level=logging.INFO)
6
+ logger = logging.getLogger("main")
7
+
8
+ # task_list
9
+ task_list = ['Classification', 'Clustering', 'Reranking', 'Retrieval', 'STS', 'PairClassification']
10
+ # languages
11
+ task_langs=["zh", "zh-CN"]
12
+
13
+ model_name = "DMetaSoul/Dmeta-embedding"
14
+ model = SentenceTransformer(model_name)
15
+ # normalize_embeddings should be true for this model
16
+ model.encode = functools.partial(model.encode, normalize_embeddings=True)
17
+ evaluation = MTEB(task_types=task_list, task_langs=task_langs)
18
+ evaluation.run(model, output_folder=f"results/zh/{model_name.split('/')[-1]}")