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

V2: Add all notebooks to test #840

Merged
merged 8 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
19 changes: 8 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,17 @@ jobs:
if: ${{ matrix.python-version == '3.11' }}
run: |
python -m pip install ".[hpopt]"
- name: Test with pytest
shell: bash -l {0}
run: |
# specifically disable running on GPU, otherwise Lightning will attempt to use the Apple GPU
# that the GitHub actions runners still have but are not allowed to actually use
pytest -v tests
# - name: Test with pytest
# shell: bash -l {0}
# run: |
# # specifically disable running on GPU, otherwise Lightning will attempt to use the Apple GPU
# # that the GitHub actions runners still have but are not allowed to actually use
# pytest -v tests
shihchengli marked this conversation as resolved.
Show resolved Hide resolved
- name: Test notebooks
shell: bash -l {0}
run: |
pytest --nbmake examples/training.ipynb
pytest --nbmake examples/predicting.ipynb
pytest --nbmake examples/convert_v1_to_v2.ipynb
pytest --nbmake examples/training_regression_multicomponent.ipynb
pytest --nbmake examples/predicting_regression_multicomponent.ipynb
python -m pip install matplotlib
pytest --no-cov -v --nbmake examples/*.ipynb

conda-test:
name: Execute Tests with Conda-based Install
Expand Down
17 changes: 8 additions & 9 deletions examples/extra_features_from_featurizer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"from rdkit import Chem\n",
"from pathlib import Path\n",
"from chemprop import data, utils\n",
"from chemprop.featurizers import MoleculeFeaturizer\n",
"from rdkit.Chem import rdFingerprintGenerator\n",
"from dataclasses import dataclass"
]
Expand Down Expand Up @@ -182,7 +181,7 @@
"metadata": {},
"source": [
"# Creating custom featurizers\n",
"Custom featurizers can be made by inheriting the ```MoleculeFeaturizer``` class.\n",
"Custom featurizers can be made by inheriting the ```SimpleMoleculeMolGraphFeaturizer``` class.\n",
"These featurizers must override the following methods:\n",
"- ```__len__(self)```\n",
"- ```__call__(self, mol: Chem.mol)```\n",
Expand All @@ -197,7 +196,7 @@
"outputs": [],
"source": [
"@dataclass\n",
"class MorganFingerprintMoleculeFeaturizer(MoleculeFeaturizer):\n",
"class MorganFingerprintMoleculeFeaturizer:\n",
" fp_size: int = 2048\n",
"\n",
" def __post_init__(self):\n",
Expand Down Expand Up @@ -257,11 +256,11 @@
{
"data": {
"text/plain": [
"[MoleculeDatapoint(mol=<rdkit.Chem.rdchem.Mol object at 0x7f0aa8a018c0>, y=array([-0.77]), weight=1, gt_mask=None, lt_mask=None, x_d=array([0, 1, 0, ..., 0, 0, 0], dtype=uint8), x_phase=None, V_f=None, E_f=None, V_d=None),\n",
" MoleculeDatapoint(mol=<rdkit.Chem.rdchem.Mol object at 0x7f0aa8a01850>, y=array([-3.3]), weight=1, gt_mask=None, lt_mask=None, x_d=array([0, 0, 0, ..., 0, 0, 0], dtype=uint8), x_phase=None, V_f=None, E_f=None, V_d=None),\n",
" MoleculeDatapoint(mol=<rdkit.Chem.rdchem.Mol object at 0x7f0aa8a019a0>, y=array([-2.06]), weight=1, gt_mask=None, lt_mask=None, x_d=array([0, 0, 0, ..., 0, 0, 0], dtype=uint8), x_phase=None, V_f=None, E_f=None, V_d=None),\n",
" MoleculeDatapoint(mol=<rdkit.Chem.rdchem.Mol object at 0x7f0aa8a01a80>, y=array([-7.87]), weight=1, gt_mask=None, lt_mask=None, x_d=array([0, 0, 0, ..., 0, 0, 0], dtype=uint8), x_phase=None, V_f=None, E_f=None, V_d=None),\n",
" MoleculeDatapoint(mol=<rdkit.Chem.rdchem.Mol object at 0x7f0aa8a01b60>, y=array([-1.33]), weight=1, gt_mask=None, lt_mask=None, x_d=array([0, 0, 0, ..., 0, 0, 0], dtype=uint8), x_phase=None, V_f=None, E_f=None, V_d=None)]"
"[MoleculeDatapoint(mol=<rdkit.Chem.rdchem.Mol object at 0x7f8f12c369d0>, y=array([-0.77]), weight=1.0, gt_mask=None, lt_mask=None, x_d=array([0, 1, 0, ..., 0, 0, 0], dtype=uint8), x_phase=None, name='OCC3OC(OCC2OC(OC(C#N)c1ccccc1)C(O)C(O)C2O)C(O)C(O)C3O', V_f=None, E_f=None, V_d=None),\n",
" MoleculeDatapoint(mol=<rdkit.Chem.rdchem.Mol object at 0x7f8f12c36810>, y=array([-3.3]), weight=1.0, gt_mask=None, lt_mask=None, x_d=array([0, 0, 0, ..., 0, 0, 0], dtype=uint8), x_phase=None, name='Cc1occc1C(=O)Nc2ccccc2', V_f=None, E_f=None, V_d=None),\n",
" MoleculeDatapoint(mol=<rdkit.Chem.rdchem.Mol object at 0x7f8f12c368f0>, y=array([-2.06]), weight=1.0, gt_mask=None, lt_mask=None, x_d=array([0, 0, 0, ..., 0, 0, 0], dtype=uint8), x_phase=None, name='CC(C)=CCCC(C)=CC(=O)', V_f=None, E_f=None, V_d=None),\n",
" MoleculeDatapoint(mol=<rdkit.Chem.rdchem.Mol object at 0x7f8f12c36ab0>, y=array([-7.87]), weight=1.0, gt_mask=None, lt_mask=None, x_d=array([0, 0, 0, ..., 0, 0, 0], dtype=uint8), x_phase=None, name='c1ccc2c(c1)ccc3c2ccc4c5ccccc5ccc43', V_f=None, E_f=None, V_d=None),\n",
" MoleculeDatapoint(mol=<rdkit.Chem.rdchem.Mol object at 0x7f8f12c36b90>, y=array([-1.33]), weight=1.0, gt_mask=None, lt_mask=None, x_d=array([0, 0, 0, ..., 0, 0, 0], dtype=uint8), x_phase=None, name='c1ccsc1', V_f=None, E_f=None, V_d=None)]"
]
},
"execution_count": 7,
Expand Down Expand Up @@ -299,7 +298,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"version": "3.11.8"
},
"orig_nbformat": 4
},
Expand Down