Skip to content

Commit

Permalink
fix: Fix load external results with None mteb_version (#1453)
Browse files Browse the repository at this point in the history
* fix

* lint
  • Loading branch information
Samoed authored Nov 14, 2024
1 parent 3397633 commit 14d7523
Showing 1 changed file with 8 additions and 11 deletions.
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

0 comments on commit 14d7523

Please sign in to comment.