Skip to content

Commit 5951aa6

Browse files
committed
update mteb eval
1 parent a70e1b2 commit 5951aa6

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

FlagEmbedding/evaluation/mteb/runner.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,8 @@ def read_results(self, output_folder, tasks):
6666
break
6767

6868
temp_data = data['scores'][split][0]
69+
tasks_results[t_type][task_name] = round(temp_data['main_score'] * 100, 2)
6970

70-
if metric == 'ap':
71-
tasks_results[t_type][task_name] = round(temp_data['cos_sim']['ap'] * 100, 2)
72-
elif metric == 'cosine_spearman':
73-
tasks_results[t_type][task_name] = round(temp_data['cos_sim']['spearman'] * 100, 2)
74-
else:
75-
tasks_results[t_type][task_name] = round(temp_data[metric] * 100, 2)
7671
print(f"tasks_results: {tasks_results}")
7772
return tasks_results
7873

FlagEmbedding/evaluation/mteb/searcher.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import numpy as np
2+
13
from typing import List, Dict, Optional
24
from FlagEmbedding.abc.evaluation import EvalDenseRetriever, EvalReranker
35

@@ -22,7 +24,7 @@ def encode_queries(self, queries: List[str], **kwargs):
2224
emb = self.embedder.encode_queries(queries)
2325
if isinstance(emb, dict):
2426
emb = emb["dense_vecs"]
25-
return emb
27+
return emb.astype(np.float32)
2628

2729
def encode_corpus(self, corpus: List[Dict[str, str]], **kwargs):
2830
if isinstance(corpus[0], dict):
@@ -32,7 +34,7 @@ def encode_corpus(self, corpus: List[Dict[str, str]], **kwargs):
3234
emb = self.embedder.encode_corpus(input_texts)
3335
if isinstance(emb, dict):
3436
emb = emb["dense_vecs"]
35-
return emb
37+
return emb.astype(np.float32)
3638

3739
def encode(self, corpus: List[Dict[str, str]], **kwargs):
3840
if isinstance(corpus[0], dict):
@@ -42,7 +44,7 @@ def encode(self, corpus: List[Dict[str, str]], **kwargs):
4244
emb = self.embedder.encode_queries(input_texts)
4345
if isinstance(emb, dict):
4446
emb = emb["dense_vecs"]
45-
return emb
47+
return emb.astype(np.float32)
4648

4749
class MTEBEvalReranker(EvalReranker):
4850
def __init__(self, reranker, **kwargs):

0 commit comments

Comments
 (0)