Spaces:
Running
Running
Muennighoff
commited on
Commit
•
6af949b
1
Parent(s):
bf18e02
Add Ada
Browse files
app.py
CHANGED
@@ -195,6 +195,8 @@ def add_task(examples):
|
|
195 |
|
196 |
for model in EXTERNAL_MODELS:
|
197 |
ds = load_dataset("mteb/results", model)
|
|
|
|
|
198 |
ds = ds.map(add_lang)
|
199 |
ds = ds.map(add_task)
|
200 |
base_dict = {"Model": make_clickable_model(model, link=EXTERNAL_MODEL_TO_LINK.get(model, "https://huggingface.co/spaces/mteb/leaderboard"))}
|
@@ -205,7 +207,7 @@ for model in EXTERNAL_MODELS:
|
|
205 |
EXTERNAL_MODEL_RESULTS[model][task][metric].append({**base_dict, **ds_dict})
|
206 |
|
207 |
|
208 |
-
def get_mteb_data(tasks=["Clustering"], langs=[], task_to_metric=TASK_TO_METRIC):
|
209 |
api = HfApi()
|
210 |
models = api.list_models(filter="mteb")
|
211 |
# Initialize list to models that we cannot fetch metadata from
|
@@ -253,7 +255,8 @@ def get_mteb_data(tasks=["Clustering"], langs=[], task_to_metric=TASK_TO_METRIC)
|
|
253 |
cols = sorted(list(df.columns))
|
254 |
cols.insert(0, cols.pop(cols.index("Model")))
|
255 |
df = df[cols]
|
256 |
-
|
|
|
257 |
return df
|
258 |
|
259 |
def get_mteb_average():
|
@@ -269,6 +272,7 @@ def get_mteb_average():
|
|
269 |
"Summarization",
|
270 |
],
|
271 |
langs=["en", "en-en"],
|
|
|
272 |
)
|
273 |
# Approximation (Missing Bitext Mining & including some nans)
|
274 |
NUM_SCORES = DATA_OVERALL.shape[0] * DATA_OVERALL.shape[1]
|
@@ -290,6 +294,9 @@ def get_mteb_average():
|
|
290 |
|
291 |
DATA_OVERALL = DATA_OVERALL.round(2)
|
292 |
|
|
|
|
|
|
|
293 |
DATA_CLASSIFICATION_EN = DATA_OVERALL[["Model"] + TASK_LIST_CLASSIFICATION]
|
294 |
DATA_CLUSTERING = DATA_OVERALL[["Model"] + TASK_LIST_CLUSTERING]
|
295 |
DATA_PAIR_CLASSIFICATION = DATA_OVERALL[["Model"] + TASK_LIST_PAIR_CLASSIFICATION]
|
|
|
195 |
|
196 |
for model in EXTERNAL_MODELS:
|
197 |
ds = load_dataset("mteb/results", model)
|
198 |
+
# For local debugging:
|
199 |
+
#, download_mode='force_redownload', ignore_verifications=True)
|
200 |
ds = ds.map(add_lang)
|
201 |
ds = ds.map(add_task)
|
202 |
base_dict = {"Model": make_clickable_model(model, link=EXTERNAL_MODEL_TO_LINK.get(model, "https://huggingface.co/spaces/mteb/leaderboard"))}
|
|
|
207 |
EXTERNAL_MODEL_RESULTS[model][task][metric].append({**base_dict, **ds_dict})
|
208 |
|
209 |
|
210 |
+
def get_mteb_data(tasks=["Clustering"], langs=[], fillna=True, task_to_metric=TASK_TO_METRIC):
|
211 |
api = HfApi()
|
212 |
models = api.list_models(filter="mteb")
|
213 |
# Initialize list to models that we cannot fetch metadata from
|
|
|
255 |
cols = sorted(list(df.columns))
|
256 |
cols.insert(0, cols.pop(cols.index("Model")))
|
257 |
df = df[cols]
|
258 |
+
if fillna:
|
259 |
+
df.fillna("", inplace=True)
|
260 |
return df
|
261 |
|
262 |
def get_mteb_average():
|
|
|
272 |
"Summarization",
|
273 |
],
|
274 |
langs=["en", "en-en"],
|
275 |
+
fillna=False
|
276 |
)
|
277 |
# Approximation (Missing Bitext Mining & including some nans)
|
278 |
NUM_SCORES = DATA_OVERALL.shape[0] * DATA_OVERALL.shape[1]
|
|
|
294 |
|
295 |
DATA_OVERALL = DATA_OVERALL.round(2)
|
296 |
|
297 |
+
# Fill NaN after averaging
|
298 |
+
DATA_OVERALL.fillna("", inplace=True)
|
299 |
+
|
300 |
DATA_CLASSIFICATION_EN = DATA_OVERALL[["Model"] + TASK_LIST_CLASSIFICATION]
|
301 |
DATA_CLUSTERING = DATA_OVERALL[["Model"] + TASK_LIST_CLUSTERING]
|
302 |
DATA_PAIR_CLASSIFICATION = DATA_OVERALL[["Model"] + TASK_LIST_PAIR_CLASSIFICATION]
|