From db7c90d54ba45a1f96f50f56fe29b0ac97195b31 Mon Sep 17 00:00:00 2001 From: Roman Solomatin <36135455+Samoed@users.noreply.github.com> Date: Thu, 14 Nov 2024 19:21:59 +0300 Subject: [PATCH 1/2] fix --- mteb/load_results/task_results.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/mteb/load_results/task_results.py b/mteb/load_results/task_results.py index d619e05a61..ba3447117a 100644 --- a/mteb/load_results/task_results.py +++ b/mteb/load_results/task_results.py @@ -290,15 +290,9 @@ 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) @@ -310,7 +304,7 @@ 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( + pre_v_12_48 = "mteb_version" in data and data["mteb_version"] is not None and Version( data["mteb_version"] ) < Version("1.12.48") From 1b7674913d2caefb3f88fa6f41d1a097104ccad0 Mon Sep 17 00:00:00 2001 From: Roman Solomatin <36135455+Samoed@users.noreply.github.com> Date: Thu, 14 Nov 2024 19:22:59 +0300 Subject: [PATCH 2/2] lint --- mteb/load_results/task_results.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mteb/load_results/task_results.py b/mteb/load_results/task_results.py index ba3447117a..71943f8771 100644 --- a/mteb/load_results/task_results.py +++ b/mteb/load_results/task_results.py @@ -291,7 +291,8 @@ def from_disk(cls, path: Path, load_historic_data: bool = True) -> TaskResult: ) pre_1_11_load = ( - "mteb_version" in data and data["mteb_version"] is not None + "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: @@ -304,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 data["mteb_version"] is not None 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)