Muennighoff commited on
Commit
1bd4020
1 Parent(s): dbfa15a

Fix multilingual langs

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -136,7 +136,10 @@ def get_mteb_data(tasks=["Clustering"], langs=[], cast_to_str=True, task_to_metr
136
  # ],
137
  # },
138
  # Use "get" instead of dict indexing to skip incompat metadata instead of erroring out
139
- 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))]
 
 
 
140
  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]
141
  #else:
142
  # Multilingual
@@ -470,7 +473,7 @@ with block:
470
  block.load(get_mteb_data, inputs=[task_clustering], outputs=data_clustering)
471
  block.load(get_mteb_data, inputs=[task_retrieval], outputs=data_retrieval)
472
  block.load(get_mteb_data, inputs=[task_reranking], outputs=data_reranking)
473
- block.load(get_mteb_data, inputs=[task_sts_en], outputs=data_sts_en)
474
  block.load(get_mteb_data, inputs=[task_sts], outputs=data_sts)
475
  block.load(get_mteb_data, inputs=[task_summarization], outputs=data_summarization)
476
 
@@ -485,3 +488,4 @@ block.launch()
485
  # Sources:
486
  # https://huggingface.co/spaces/gradio/leaderboard
487
  # https://huggingface.co/spaces/huggingface-projects/Deep-Reinforcement-Learning-Leaderboard
 
 
136
  # ],
137
  # },
138
  # Use "get" instead of dict indexing to skip incompat metadata instead of erroring out
139
+ if langs:
140
+ 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))]
141
+ else:
142
+ task_results = [sub_res for sub_res in meta["model-index"][0]["results"] if (sub_res.get("task", {}).get("type", "") in tasks)]
143
  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]
144
  #else:
145
  # Multilingual
 
473
  block.load(get_mteb_data, inputs=[task_clustering], outputs=data_clustering)
474
  block.load(get_mteb_data, inputs=[task_retrieval], outputs=data_retrieval)
475
  block.load(get_mteb_data, inputs=[task_reranking], outputs=data_reranking)
476
+ block.load(get_mteb_data, inputs=[task_sts_en, lang_sts_en], outputs=data_sts_en)
477
  block.load(get_mteb_data, inputs=[task_sts], outputs=data_sts)
478
  block.load(get_mteb_data, inputs=[task_summarization], outputs=data_summarization)
479
 
 
488
  # Sources:
489
  # https://huggingface.co/spaces/gradio/leaderboard
490
  # https://huggingface.co/spaces/huggingface-projects/Deep-Reinforcement-Learning-Leaderboard
491
+ # https://getemoji.com/