From 33ab8ea6b0adeb98234cde18865096609e9a0d53 Mon Sep 17 00:00:00 2001 From: miquelduranfrigola Date: Sat, 19 Nov 2022 13:45:08 +0100 Subject: [PATCH] bugfixed presets prediction time --- zairachem/__init__.py | 9 ++++----- zairachem/estimators/from_molmap/estimate.py | 4 +++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/zairachem/__init__.py b/zairachem/__init__.py index 84acda0a..fc0ac93c 100644 --- a/zairachem/__init__.py +++ b/zairachem/__init__.py @@ -101,11 +101,10 @@ def is_train(self): def is_lazy(self): output_dir = self.get_output_dir() model_dir = self.get_trained_dir() - with open(os.path.join(output_dir, DATA_SUBFOLDER, PRESETS_FILENAME), "r") as f: - data = json.load(f) - if data["is_lazy"]: - return True - with open(os.path.join(model_dir, DATA_SUBFOLDER, PRESETS_FILENAME), "r") as f: + file_name = os.path.join(output_dir, DATA_SUBFOLDER, PRESETS_FILENAME) + if not os.path.exists(file_name): + file_name = os.path.join(model_dir, DATA_SUBFOLDER, PRESETS_FILENAME) + with open(file_name, "r") as f: data = json.load(f) if data["is_lazy"]: return True diff --git a/zairachem/estimators/from_molmap/estimate.py b/zairachem/estimators/from_molmap/estimate.py index 8c47ee40..f71f90fd 100644 --- a/zairachem/estimators/from_molmap/estimate.py +++ b/zairachem/estimators/from_molmap/estimate.py @@ -27,7 +27,9 @@ def __init__(self, path): self.get_output_dir(), ESTIMATORS_SUBFOLDER, ESTIMATORS_FAMILY_SUBFOLDER ) if _USE_AUGMENTED: - if os.path.exists(self.path, DATA_SUBFOLDER, DATA_AUGMENTED_FILENAME): + if os.path.exists( + os.path.join(self.path, DATA_SUBFOLDER, DATA_AUGMENTED_FILENAME) + ): self._data_filename = DATA_AUGMENTED_FILENAME else: self._data_filename = DATA_FILENAME