Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
quick fix
#5
by
nouamanetazi
HF staff
- opened
app.py
CHANGED
@@ -351,10 +351,12 @@ def get_mteb_data(tasks=["Clustering"], langs=[], fillna=True, add_emb_dim=False
|
|
351 |
# ],
|
352 |
# },
|
353 |
# Use "get" instead of dict indexing to skip incompat metadata instead of erroring out
|
|
|
|
|
354 |
if langs:
|
355 |
-
task_results = [sub_res for sub_res in meta["model-index"][0]["results"] if (sub_res.get("task", {}).get("type", "") in tasks) and (sub_res.get("dataset", {}).get("config", "default") in ("default", *langs))]
|
356 |
else:
|
357 |
-
task_results = [sub_res for sub_res in meta["model-index"][0]["results"] if (sub_res.get("task", {}).get("type", "") in tasks)]
|
358 |
out = [{res["dataset"]["name"].replace("MTEB ", ""): [round(score["value"], 2) for score in res["metrics"] if score["type"] == task_to_metric.get(res["task"]["type"])][0]} for res in task_results]
|
359 |
out = {k: v for d in out for k, v in d.items()}
|
360 |
out["Model"] = make_clickable_model(model.modelId)
|
|
|
351 |
# ],
|
352 |
# },
|
353 |
# Use "get" instead of dict indexing to skip incompat metadata instead of erroring out
|
354 |
+
if not "model-index" in meta or not meta["model-index"] or not "results" in meta["model-index"][0]:
|
355 |
+
continue
|
356 |
if langs:
|
357 |
+
task_results = [sub_res for sub_res in meta["model-index"][0]["results"] if "model-index" in meta and (sub_res.get("task", {}).get("type", "") in tasks) and (sub_res.get("dataset", {}).get("config", "default") in ("default", *langs))]
|
358 |
else:
|
359 |
+
task_results = [sub_res for sub_res in meta["model-index"][0]["results"] if "model-index" in meta and (sub_res.get("task", {}).get("type", "") in tasks)]
|
360 |
out = [{res["dataset"]["name"].replace("MTEB ", ""): [round(score["value"], 2) for score in res["metrics"] if score["type"] == task_to_metric.get(res["task"]["type"])][0]} for res in task_results]
|
361 |
out = {k: v for d in out for k, v in d.items()}
|
362 |
out["Model"] = make_clickable_model(model.modelId)
|