From 7f94326a3fb4b03e85b120c456d541c07bc3d067 Mon Sep 17 00:00:00 2001 From: Geoff Pleiss Date: Mon, 27 Jun 2022 16:46:36 -0400 Subject: [PATCH] 1.7 release (#2037) * Bump dependencies: Python 3.7, Torch 1.10 * Update publishing script * Consolidate unit test scripts Co-authored-by: Max Balandat --- .conda/meta.yaml | 7 +- .../{python-publish-pypi.yml => deploy.yml} | 21 ++++- .github/workflows/examples.yml | 29 ------- .github/workflows/linting.yml | 33 -------- .github/workflows/run_test_suite.yml | 77 +++++++++++++++++++ .github/workflows/unittests.yml | 39 ---------- README.md | 11 ++- docs/source/index.rst | 1 + docs/source/metrics.rst | 19 +++++ environment.yml | 3 +- gpytorch/__init__.py | 2 +- requirements.txt | 5 +- setup.py | 5 +- 13 files changed, 136 insertions(+), 116 deletions(-) rename .github/workflows/{python-publish-pypi.yml => deploy.yml} (61%) delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/linting.yml create mode 100644 .github/workflows/run_test_suite.yml delete mode 100644 .github/workflows/unittests.yml create mode 100644 docs/source/metrics.rst diff --git a/.conda/meta.yaml b/.conda/meta.yaml index 1bc9d97d1..645c728d8 100644 --- a/.conda/meta.yaml +++ b/.conda/meta.yaml @@ -13,11 +13,12 @@ build: requirements: host: - - python>=3.6 + - python>=3.7 run: - - pytorch>=1.9 - - scikit-learn + - pytorch>=1.10 + - numpy + - scikit-learn<=1.0.2 # newer versions require py3.8 - scipy test: diff --git a/.github/workflows/python-publish-pypi.yml b/.github/workflows/deploy.yml similarity index 61% rename from .github/workflows/python-publish-pypi.yml rename to .github/workflows/deploy.yml index 7f8a3bacc..400e33584 100644 --- a/.github/workflows/python-publish-pypi.yml +++ b/.github/workflows/deploy.yml @@ -1,16 +1,19 @@ # This workflow will upload a Python Package using Twine when a release is created # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries -name: Upload Python Package to PyPI +name: Upload Python Package to PyPI and Anaconda on: release: types: [created] jobs: - deploy: - runs-on: ubuntu-latest + run_test_suite: + uses: ./.github/workflows/run_test_suite.yml + deploy_pypi: + runs-on: ubuntu-latest + needs: run_test_suite steps: - uses: actions/checkout@v2 - name: Set up Python @@ -28,3 +31,15 @@ jobs: run: | python setup.py sdist bdist_wheel twine upload dist/* + + deploy_conda: + runs-on: ubuntu-latest + needs: run_test_suite + steps: + - uses: actions/checkout@master + - name: publish-to-conda + uses: cornellius-gp/conda-package-publish-action@master + with: + subDir: '.' + AnacondaUsername: ${{ secrets.ANACONDA_PASSWORD }} + AnacondaPassword: ${{ secrets.ANACONDA_USERNAME }} diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 050c53d01..000000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,29 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: GPyTorch Examples - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.7" - - name: Install dependencies - run: | - pip install pytest nbval jupyter tqdm matplotlib torchvision scipy - python setup.py build develop - pip install "pyro-ppl<=1.8"; - - name: Run example notebooks - run: | - grep -l smoke_test examples/**/*.ipynb | xargs grep -L 'smoke_test = False' | CI=true xargs pytest --nbval-lax --current-env diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml deleted file mode 100644 index 9ab67b159..000000000 --- a/.github/workflows/linting.yml +++ /dev/null @@ -1,33 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: GPyTorch Linting - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.7" - - name: Install dependencies - run: | - pip install flake8==4.0.1 flake8-print==4.0.0 pre-commit - pre-commit install - pre-commit run seed-isort-config || true - - name: Run linting - run: | - flake8 - - name: Run pre-commit checks - # skipping flake8 here (run separatey above b/c pre-commit does not include flake8-print) - run: | - SKIP=flake8 pre-commit run --files test/**/*.py gpytorch/**/*.py diff --git a/.github/workflows/run_test_suite.yml b/.github/workflows/run_test_suite.yml new file mode 100644 index 000000000..2adab5fff --- /dev/null +++ b/.github/workflows/run_test_suite.yml @@ -0,0 +1,77 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Run Test Suite + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_call: + +jobs: + run_linter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.7" + - name: Install dependencies + run: | + pip install flake8==4.0.1 flake8-print==4.0.0 pre-commit + pre-commit install + pre-commit run seed-isort-config || true + - name: Run linting + run: | + flake8 + - name: Run pre-commit checks + # skipping flake8 here (run separatey above b/c pre-commit does not include flake8-print) + run: | + SKIP=flake8 pre-commit run --files test/**/*.py gpytorch/**/*.py + + run_unit_tests: + runs-on: ubuntu-latest + strategy: + matrix: + pytorch-version: ["master", "stable"] + pyro: ["with-pyro", "no-pyro"] + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.7" + - name: Install dependencies + run: | + if [[ ${{ matrix.pytorch-version }} = "master" ]]; then + pip install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html; + else + pip install torch==1.10+cpu -f https://download.pytorch.org/whl/torch_stable.html; + fi + if [[ ${{ matrix.pyro }} == "with-pyro" ]]; then + pip install "pyro-ppl<=1.8"; + fi + pip install -r requirements.txt + - name: Run unit tests + run: | + python -m unittest discover + + run_examples: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.7" + - name: Install dependencies + run: | + pip install pytest nbval jupyter tqdm matplotlib torchvision scipy + python setup.py build develop + pip install "pyro-ppl<=1.8"; + - name: Run example notebooks + run: | + grep -l smoke_test examples/**/*.ipynb | xargs grep -L 'smoke_test = False' | CI=true xargs pytest --nbval-lax --current-env diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml deleted file mode 100644 index 26ce015e7..000000000 --- a/.github/workflows/unittests.yml +++ /dev/null @@ -1,39 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: GPyTorch Unit Tests - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - pytorch-version: ["master", "stable"] - pyro: ["with-pyro", "no-pyro"] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.7" - - name: Install dependencies - run: | - if [[ ${{ matrix.pytorch-version }} = "master" ]]; then - pip install --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html; - else - pip install torch==1.9+cpu -f https://download.pytorch.org/whl/torch_stable.html; - fi - if [[ ${{ matrix.pyro }} == "with-pyro" ]]; then - pip install "pyro-ppl<=1.8"; - fi - pip install -r requirements.txt - - name: Run unit tests - run: | - python -m unittest discover diff --git a/README.md b/README.md index 3dcfb517d..352f2c3af 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ See our numerous [**examples and tutorials**](https://gpytorch.readthedocs.io/en ## Installation **Requirements**: -- Python >= 3.6 -- PyTorch >= 1.9 +- Python >= 3.7 +- PyTorch >= 1.10 Install GPyTorch using pip or conda: @@ -96,4 +96,9 @@ GPyTorch is primarily maintained by: We would like to thank our other contributors including (but not limited to) David Arbour, Eytan Bakshy, David Eriksson, Jared Frank, Sam Stanton, Bram Wallace, Ke Alexander Wang, Ruihan Wu. ## Acknowledgements -Development of GPyTorch is supported by funding from the [Bill and Melinda Gates Foundation](https://www.gatesfoundation.org/), the [National Science Foundation](https://www.nsf.gov/), and [SAP](https://www.sap.com/index.html). +Development of GPyTorch is supported by funding from +the [Bill and Melinda Gates Foundation](https://www.gatesfoundation.org/), +the [National Science Foundation](https://www.nsf.gov/), +[SAP](https://www.sap.com/index.html), +the [Simons Foundation](https://www.simonsfoundation.org), +and the [Gatsby Charitable Trust](https://www.gatsby.org.uk). diff --git a/docs/source/index.rst b/docs/source/index.rst index 7fd396dbf..84ca229ea 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -31,6 +31,7 @@ GPyTorch's documentation kernels means marginal_log_likelihoods + metrics constraints distributions priors diff --git a/docs/source/metrics.rst b/docs/source/metrics.rst new file mode 100644 index 000000000..cedada98d --- /dev/null +++ b/docs/source/metrics.rst @@ -0,0 +1,19 @@ +.. role:: hidden + :class: hidden-section + +gpytorch.metrics +=================================== + +.. automodule:: gpytorch.metrics +.. currentmodule:: gpytorch.metrics + +See `the metrics tutorial`_ for usage instructions. + +.. automethod:: gpytorch.metrics.mean_absolute_error +.. automethod:: gpytorch.metrics.mean_squared_error +.. automethod:: gpytorch.metrics.mean_standardized_log_loss +.. automethod:: gpytorch.metrics.negative_log_predictive_density +.. automethod:: gpytorch.metrics.quantile_coverage_error + +.. _the metrics tutorial: + examples/00_Basic_Usage/Metrics.html diff --git a/environment.yml b/environment.yml index 23a5d2e95..5650c04c4 100644 --- a/environment.yml +++ b/environment.yml @@ -3,5 +3,6 @@ channels: - pytorch dependencies: - pytorch - - scikit-learn + - numpy + - scikit-learn<=1.0.2 # newer versions require py3.8 - scipy diff --git a/gpytorch/__init__.py b/gpytorch/__init__.py index dcf1f4720..6f284ab3b 100644 --- a/gpytorch/__init__.py +++ b/gpytorch/__init__.py @@ -33,7 +33,7 @@ from .mlls import ExactMarginalLogLikelihood from .module import Module -__version__ = "1.6.0" +__version__ = "1.7.0" __all__ = [ # Submodules diff --git a/requirements.txt b/requirements.txt index 80dc1b163..b2cff80d7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ -torch>=1.9 -scikit-learn +torch>=1.10 +numpy +scikit-learn<=1.0.2 # newer versions require py3.8 scipy diff --git a/setup.py b/setup.py index ea88920e3..9bf5ad1a5 100644 --- a/setup.py +++ b/setup.py @@ -25,8 +25,8 @@ def find_version(*file_paths): version = find_version("gpytorch", "__init__.py") -torch_min = "1.9" -install_requires = [">=".join(["torch", torch_min]), "scikit-learn", "scipy"] +torch_min = "1.10" +install_requires = [">=".join(["torch", torch_min])] # if recent dev version of PyTorch is installed, no need to install stable try: import torch @@ -35,6 +35,7 @@ def find_version(*file_paths): install_requires = [] except ImportError: pass +install_requires += ["numpy", "scikit-learn<=1.0.2", "scipy"] # Run the setup