Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mteb/abstasks/AbsTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def evaluate(
hf_subsets = copy(self.hf_subsets)

if subsets_to_run is not None: # allow overwrites of pre-filtering
hf_subsets = subsets_to_run
hf_subsets = [s for s in hf_subsets if s in subsets_to_run]

for hf_subset in hf_subsets:
logger.info(
Expand Down
10 changes: 4 additions & 6 deletions tests/test_benchmark/mock_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,12 +927,10 @@ def load_data(self, **kwargs):
),
}

self.dataset = DatasetDict(
{
"eng": data,
"fra": data,
}
)
self.dataset = {}
for lang in self.hf_subsets:
Comment thread
Samoed marked this conversation as resolved.
self.dataset[lang] = data

self.data_loaded = True

@property
Expand Down
10 changes: 10 additions & 0 deletions tests/test_evaluation/test_split_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
)
from tests.test_benchmark.mock_tasks import (
MockMultilingualRetrievalTask,
MockMultilingualSTSTask,
MockRetrievalTask,
)

Expand Down Expand Up @@ -362,3 +363,12 @@ def test_all_splits_subsets_evaluated_with_overwrite(
for split in ["test"]:
assert len(results2[0].scores[split]) == 2
assert sorted(results2[0].languages) == ["eng", "fra"]


def test_splits_evaluated_with_prefiltering():
"""Test that the evaluation only runs on the specified languages. Issue https://github.com/embeddings-benchmark/mteb/pull/1787#issuecomment-2598205049"""
task = MockMultilingualSTSTask().filter_languages(languages=["fra"])

evaluation = MTEB(tasks=[task])

evaluation.run(MockSentenceTransformer(), overwrite_results=True)
Comment thread
Samoed marked this conversation as resolved.
Outdated