Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add E5 model test case in test CLI #958

Merged
merged 10 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all 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: 2 additions & 0 deletions docs/mmteb/points/958.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{"GitHub": "isaac-chung", "Bug fixes": 2}
{"GitHub": "KennethEnevoldsen", "Review PR": 2}
2 changes: 1 addition & 1 deletion mteb/evaluation/evaluators/ClassificationEvaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(
y_train,
sentences_test,
y_test,
task_name: str,
task_name: str | None = None,
k: int = 1,
batch_size: int = 32,
limit: int | None = None,
Expand Down
2 changes: 1 addition & 1 deletion mteb/evaluation/evaluators/SummarizationEvaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class SummarizationEvaluator(Evaluator):
def __init__(
self,
task_name: str | None,
task_name: str | None = None,
human_summaries=None,
machine_summaries=None,
texts=None,
Expand Down
25 changes: 21 additions & 4 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from argparse import Namespace
from pathlib import Path

import pytest
import yaml

from mteb.cli import create_meta
Expand All @@ -18,17 +19,33 @@ def test_available_tasks():
), "Sample task Banking77Classification task not found in available tasks"


run_task_fixures = [
(
"average_word_embeddings_komninos",
"BornholmBitextMining",
"21eec43590414cb8e3a6f654857abed0483ae36e",
),
(
"intfloat/multilingual-e5-small",
"BornholmBitextMining",
"e4ce9877abf3edfe10b0d82785e83bdcb973e22e",
),
]


@pytest.mark.parametrize("model_name,task_name,model_revision", run_task_fixures)
def test_run_task(
model_name: str = "average_word_embeddings_komninos",
task_name="BornholmBitextMining",
model_revision="21eec43590414cb8e3a6f654857abed0483ae36e",
model_name: str,
task_name: str,
model_revision: str,
):
command = f"mteb run -m {model_name} -t {task_name} --verbosity 3 --output_folder tests/results/test_model --model_revision {model_revision}"
result = subprocess.run(command, shell=True, capture_output=True, text=True)
assert result.returncode == 0, "Command failed"

model_name_as_path = model_name.replace("/", "__").replace(" ", "_")
results_path = Path(
f"tests/results/test_model/average_word_embeddings_komninos/{model_revision}"
f"tests/results/test_model/{model_name_as_path}/{model_revision}"
)
assert results_path.exists(), "Output folder not created"
assert "model_meta.json" in [
Expand Down
Loading