diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18db3e0..dbbd67a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,18 +17,21 @@ jobs: steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.10 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' + cache: pip + cache-dependency-path: | + **/requirements*.txt - name: Install pre-commit run: | python -m pip install --upgrade pip pip install -U setuptools wheel - pip install .[dev,bayesian] + pip install .[dev] - name: Run pre-commit run: | @@ -45,10 +48,10 @@ jobs: steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: 'pip' @@ -59,9 +62,13 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt - pip install .[test,dev,bayesian] + pip install .[test,dev] + + - name: List installed versions + run: | + pip list - name: Run tests with pytest run: | # run tests with pytest, reporting coverage and timings - pytest -m "not slow" -rs -vvv --durations=0 --cov=./modnet/ + pytest -m "not slow" -m "not deprecated" -rs -vvv --durations=0 --cov=./modnet/ diff --git a/modnet/models/ensemble.py b/modnet/models/ensemble.py index 880d09e..dc2fce8 100644 --- a/modnet/models/ensemble.py +++ b/modnet/models/ensemble.py @@ -438,7 +438,7 @@ def fit_preset( for i in range(n_splits): best_5_idx = np.argsort(val_losses[:, i])[:5] for idx in best_5_idx: - final_models += models[idx][i].model + final_models.extend(models[idx][i].models) self.__init__(modnet_models=final_models) os.environ["TF_CPP_MIN_LOG_LEVEL"] = "0" # reset diff --git a/modnet/models/vanilla.py b/modnet/models/vanilla.py index 56ebd7f..6eb8b4f 100644 --- a/modnet/models/vanilla.py +++ b/modnet/models/vanilla.py @@ -1343,6 +1343,9 @@ def fit( } fit_params.update(fit_params_kw) + if "learning_rate" in fit_params: + fit_params.pop("learning_rate") + warnings.warn("learning_rate is deprecated, use lr instead.") if loss is None: loss = "mse" diff --git a/modnet/tests/test_model.py b/modnet/tests/test_model.py index c4853e0..1742b46 100644 --- a/modnet/tests/test_model.py +++ b/modnet/tests/test_model.py @@ -142,6 +142,7 @@ def test_model_integration(subset_moddata, tf_session): assert not np.isnan(model.evaluate(data)) +@pytest.mark.deprecated def test_train_small_bayesian_single_target(subset_moddata, tf_session): """Tests the single target training.""" from modnet.models import BayesianMODNetModel @@ -165,6 +166,7 @@ def test_train_small_bayesian_single_target(subset_moddata, tf_session): assert not np.isnan(model.evaluate(data)) +@pytest.mark.deprecated def test_train_small_bayesian_single_target_classif(subset_moddata, tf_session): """Tests the single target training.""" from modnet.models import BayesianMODNetModel @@ -196,6 +198,7 @@ def is_metal(egap): assert not np.isnan(model.evaluate(data)) +@pytest.mark.deprecated def test_train_small_bayesian_multi_target(subset_moddata, tf_session): """Tests the multi-target training.""" from modnet.models import BayesianMODNetModel diff --git a/pytest.ini b/pytest.ini index 7617853..c382c88 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,3 +1,4 @@ [pytest] markers = slow: marks tests as slow (deselect with '-m "not slow"') + deprecated: mark tests as deprecated (deselect with -m "not deprecated") diff --git a/requirements.txt b/requirements.txt index 81c0afa..24046bc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,6 @@ -tensorflow==2.11.0 -pandas==1.5.2 -scikit-learn==1.3.2 +tensorflow==2.15.1 +pandas==2.2.3 +scikit-learn==1.5.0 matminer==0.9.2 numpy>=1.25 -pymatgen==2024.3.1 -scikit-learn==1.3.2 +pymatgen==2024.5.31 diff --git a/setup.py b/setup.py index 28781da..849a339 100644 --- a/setup.py +++ b/setup.py @@ -32,17 +32,17 @@ include_package_data=True, packages=setuptools.find_packages(), install_requires=[ - "pandas~=1.5", - "tensorflow~=2.10,<2.12", - "pymatgen>=2023", - "matminer~=0.9", - "numpy>=1.24", - "scikit-learn~=1.3", + "pandas <= 1.5, < 3", + "tensorflow ~= 2.10, < 2.16", + "pymatgen >= 2023", + "matminer ~= 0.9", + "numpy >= 1.24", + "scikit-learn ~= 1.3", ], tests_require=tests_require, test_suite="modnet.tests", extras_require={ - "bayesian": ["tensorflow-probability==0.18"], + "bayesian": ["tensorflow-probability==0.18", "tensorflow == 2.11.*"], "test": tests_require, "dev": dev_require, },