diff --git a/mteb/load_results/task_results.py b/mteb/load_results/task_results.py index d619e05a6..71943f877 100644 --- a/mteb/load_results/task_results.py +++ b/mteb/load_results/task_results.py @@ -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) @@ -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)