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: Fix load external results with None mteb_version #1453

Merged
merged 2 commits into from
Nov 14, 2024
Merged
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
19 changes: 8 additions & 11 deletions mteb/load_results/task_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,10 @@ def from_disk(cls, path: Path, load_historic_data: bool = True) -> TaskResult:
f"Error loading TaskResult from disk. You can try to load historic data by setting `load_historic_data=True`. Error: {e}"
)

if ("mteb_version" in data) and (data["mteb_version"] is None):
data.pop("mteb_version")

pre_1_11_load = (
(
"mteb_version" in data
and Version(data["mteb_version"]) < Version("1.11.0")
)
or "mteb_version" not in data
"mteb_version" in data
and data["mteb_version"] is not None
and Version(data["mteb_version"]) < Version("1.11.0")
) # assume it is before 1.11.0 if the version is not present
try:
obj = cls.model_validate(data)
Expand All @@ -310,9 +305,11 @@ def from_disk(cls, path: Path, load_historic_data: bool = True) -> TaskResult:
)
obj = cls._convert_from_before_v1_11_0(data)

pre_v_12_48 = "mteb_version" in data and Version(
data["mteb_version"]
) < Version("1.12.48")
pre_v_12_48 = (
"mteb_version" in data
and data["mteb_version"] is not None
and Version(data["mteb_version"]) < Version("1.12.48")
)

if pre_v_12_48:
cls._fix_pair_classification_scores(obj)
Expand Down