From 0f26a62130964195ae3ecb5fcba2fd2e4b82149b Mon Sep 17 00:00:00 2001 From: Brendan King Date: Wed, 5 Feb 2025 13:25:07 -0700 Subject: [PATCH 1/5] changed 'import tensorflow.keras' to 'import keras' --- nmma/em/model.py | 2 +- nmma/em/training.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nmma/em/model.py b/nmma/em/model.py index 67f5578e..0c5cd174 100644 --- a/nmma/em/model.py +++ b/nmma/em/model.py @@ -307,7 +307,7 @@ def __init__( import tensorflow as tf tf.get_logger().setLevel("ERROR") - from tensorflow.keras.models import load_model + from keras.models import load_model if not local_only: _, model_filters = get_model(self.svd_path, f"{self.model}_tf", filters=filters) diff --git a/nmma/em/training.py b/nmma/em/training.py index f1d1f2fa..d5c9d479 100644 --- a/nmma/em/training.py +++ b/nmma/em/training.py @@ -415,8 +415,8 @@ def train_tensorflow_model(self, dropout_rate=0.6): tf.get_logger().setLevel("ERROR") from sklearn.model_selection import train_test_split - from tensorflow.keras import Sequential - from tensorflow.keras.layers import Dense, Dropout + from keras import Sequential + from keras.layers import Dense, Dropout except ImportError: print("Install tensorflow if you want to use it...") return @@ -436,7 +436,7 @@ def train_tensorflow_model(self, dropout_rate=0.6): random_state=self.random_seed, ) - tf.keras.utils.set_random_seed(self.random_seed) + keras.utils.set_random_seed(self.random_seed) if self.model_exists and self.continue_training: model = self.svd_model[filt]["model"] @@ -561,7 +561,7 @@ def load_model(self): elif self.interpolation_type == "tensorflow": try: - from tensorflow.keras.models import load_model as load_tf_model + from keras.models import load_model as load_tf_model except ImportError: print("Install tensorflow if you want to use it...") return From c070c26d5960491c13bc0398ad22df6c869bb8c3 Mon Sep 17 00:00:00 2001 From: Brendan King Date: Wed, 5 Feb 2025 13:34:16 -0700 Subject: [PATCH 2/5] (+) import keras --- nmma/em/training.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nmma/em/training.py b/nmma/em/training.py index d5c9d479..ee0c80a7 100644 --- a/nmma/em/training.py +++ b/nmma/em/training.py @@ -4,6 +4,7 @@ import warnings import matplotlib.pyplot as plt import numpy as np +import keras from scipy.interpolate import interpolate as interp from scipy.interpolate import UnivariateSpline From 13736db31ecc65aaf92d5c1b06c582eb220e2b54 Mon Sep 17 00:00:00 2001 From: Sahil Jhawar <55475299+sahiljhawar@users.noreply.github.com> Date: Wed, 5 Feb 2025 21:48:11 +0100 Subject: [PATCH 3/5] Update continous_integration.yml change --preinstall to --auto-update --- .github/workflows/continous_integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continous_integration.yml b/.github/workflows/continous_integration.yml index 204cc3d2..0d35d319 100644 --- a/.github/workflows/continous_integration.yml +++ b/.github/workflows/continous_integration.yml @@ -63,7 +63,7 @@ jobs: - name: Update Homebrew if: matrix.os == 'macos-latest' run: | - brew update --preinstall + brew update --auto-update - name: Configure Homebrew cache if: matrix.os == 'macos-latest' From e67535d6dc04eb7d7067bffe17154b3d8110438b Mon Sep 17 00:00:00 2001 From: Sahil Jhawar <55475299+sahiljhawar@users.noreply.github.com> Date: Wed, 5 Feb 2025 22:24:54 +0100 Subject: [PATCH 4/5] Update pyproject.toml add asyncio options --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 3816364a..8a9f519e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -124,6 +124,8 @@ profile = "black" [tool.pytest.ini_options] addopts = "--verbose -r s" +asyncio_mode = "auto" +asyncio_default_fixture_loop_scope = "session" [tool.bumpver] current_version = "0.2.2" From 3ac1fbe714ccfd63730fc9f5511e18aaf1f2c7b1 Mon Sep 17 00:00:00 2001 From: Sahil Jhawar <55475299+sahiljhawar@users.noreply.github.com> Date: Wed, 5 Feb 2025 22:53:40 +0100 Subject: [PATCH 5/5] try strict mode --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8a9f519e..7685bacd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -124,7 +124,7 @@ profile = "black" [tool.pytest.ini_options] addopts = "--verbose -r s" -asyncio_mode = "auto" +asyncio_mode = "strict" asyncio_default_fixture_loop_scope = "session" [tool.bumpver]