add subset to old format (#33)
Browse files- results.py +4 -2
results.py
CHANGED
@@ -371,7 +371,7 @@ class MTEBResults(datasets.GeneratorBasedBuilder):
|
|
371 |
# Old MTEB format
|
372 |
if isinstance(res_dict.get(split), dict):
|
373 |
for k, v in res_dict.get(split, {}).items():
|
374 |
-
if
|
375 |
res_dict[k] = v
|
376 |
|
377 |
v /= len(TEST_AVG_SPLIT[ds_name])
|
@@ -383,7 +383,7 @@ class MTEBResults(datasets.GeneratorBasedBuilder):
|
|
383 |
elif isinstance(res_dict.get(split), list):
|
384 |
assert len(res_dict[split]) == 1, "Only single-lists supported for now"
|
385 |
for k, v in res_dict[split][0].items():
|
386 |
-
if
|
387 |
res_dict[k] = v
|
388 |
if not isinstance(v, float): continue
|
389 |
v /= len(TEST_AVG_SPLIT[ds_name])
|
@@ -451,6 +451,8 @@ class MTEBResults(datasets.GeneratorBasedBuilder):
|
|
451 |
if lang in SKIP_KEYS: continue
|
452 |
test_result_lang = res_dict.get(lang) if is_multilingual else res_dict
|
453 |
subset = test_result_lang.pop("hf_subset", "")
|
|
|
|
|
454 |
for metric, score in test_result_lang.items():
|
455 |
if not isinstance(score, dict):
|
456 |
score = {metric: score}
|
|
|
371 |
# Old MTEB format
|
372 |
if isinstance(res_dict.get(split), dict):
|
373 |
for k, v in res_dict.get(split, {}).items():
|
374 |
+
if k in ["hf_subset", "languages"]:
|
375 |
res_dict[k] = v
|
376 |
|
377 |
v /= len(TEST_AVG_SPLIT[ds_name])
|
|
|
383 |
elif isinstance(res_dict.get(split), list):
|
384 |
assert len(res_dict[split]) == 1, "Only single-lists supported for now"
|
385 |
for k, v in res_dict[split][0].items():
|
386 |
+
if k in ["hf_subset", "languages"]:
|
387 |
res_dict[k] = v
|
388 |
if not isinstance(v, float): continue
|
389 |
v /= len(TEST_AVG_SPLIT[ds_name])
|
|
|
451 |
if lang in SKIP_KEYS: continue
|
452 |
test_result_lang = res_dict.get(lang) if is_multilingual else res_dict
|
453 |
subset = test_result_lang.pop("hf_subset", "")
|
454 |
+
if subset == "" and is_multilingual:
|
455 |
+
subset = lang
|
456 |
for metric, score in test_result_lang.items():
|
457 |
if not isinstance(score, dict):
|
458 |
score = {metric: score}
|