Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing GitHub CI and tests. #64

Merged
merged 8 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 24 additions & 25 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build
name: Build GAUCHE and run unit tests.

on:
push:
Expand All @@ -15,31 +15,30 @@ on:
- "CONTRIBUTING.md"
- "imgs/"

permissions:
contents: read

jobs:
build_cpu:
runs-on: ubuntu-18.04
build:

runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
python-version: [3.7, 3.8, 3.9, 3.11]
steps:
- name: Checkout repository
uses: actions/checkout@v2
# See: https://github.com/marketplace/actions/setup-conda
- name: Setup anaconda
uses: s-weigand/setup-conda@v1
with:
python-version: ${{ matrix.python-version }}
conda-channels: "conda-forge"
python-version: ["3.9", "3.10", "3.11"]

- name: Install GAUCHE
run: pip install -e .
- name: Install rnxfp
run: pip install --no-deps rxnfp
- name: Install drfp
run: pip install --no-deps drfp
- name: Install transformers
run: pip install transformers
- name: Run unit tests and generate coverage report
run: pytest .
- name: Test notebook execution
run: pytest --nbval-lax notebooks/ --current-env
steps:
- uses: actions/checkout@v4
- name: Set up Python.
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up GAUCHE and install all dependencies.
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e .[all]
- name: Run unit tests with pytest.
run: |
pytest tests/
35 changes: 8 additions & 27 deletions .github/workflows/code-style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,34 @@ on: [push]
jobs:
black:
name: "Ensure black compliance"
runs-on: "ubuntu-18.04"
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"

- name: Install code style checking tools
run: python -m pip install black

- name: Run black
run: black --check .

interrogate:
name: "Ensure docstring coverage"
runs-on: "ubuntu-18.04"
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install code style checking tools
run: python -m pip install interrogate

- name: Run interrogate
run: interrogate .


isort:
name: "Ensure imports are correctly sorted"
runs-on: "ubuntu-18.04"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"

- name: Install code style checking tools
run: python -m pip install isort
Expand Down
5 changes: 2 additions & 3 deletions benchmarks/benchmark_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
GP Model definitions to be used in the benchmarks
"""

from gauche.kernels.fingerprint_kernels.tanimoto_kernel import (
TanimotoKernel,
)
from gpytorch.distributions import MultivariateNormal
from gpytorch.kernels import LinearKernel, ScaleKernel
from gpytorch.means import ConstantMean
from gpytorch.models import ExactGP

from gauche.kernels.fingerprint_kernels.tanimoto_kernel import TanimotoKernel


class TanimotoGP(ExactGP):
def __init__(self, train_x, train_y, likelihood):
Expand Down
5 changes: 3 additions & 2 deletions benchmarks/run_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import torch
from benchmark_models import ScalarProductGP, TanimotoGP
from botorch import fit_gpytorch_model
from gauche.dataloader import MolPropLoader
from gauche.dataloader.data_utils import transform_data
from gpytorch.likelihoods import GaussianLikelihood
from gpytorch.mlls import ExactMarginalLogLikelihood
from gpytorch_metrics import (
Expand All @@ -23,6 +21,9 @@
from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score
from sklearn.model_selection import train_test_split

from gauche.dataloader import MolPropLoader
from gauche.dataloader.data_utils import transform_data

# Remove Graphein warnings
logging.getLogger("graphein").setLevel("ERROR")

Expand Down
Loading