From 38d466538c7830159d80554f3ce52e020bc1cb7b Mon Sep 17 00:00:00 2001 From: Josh Mitchell Date: Tue, 12 Nov 2024 13:53:43 +1100 Subject: [PATCH 1/8] Test on MacOS and remove progress bar from example --- .github/workflows/examples-ci.yaml | 102 +++++++++--------- .../train-gnn-to-electric-field.ipynb | 51 +++++++-- 2 files changed, 94 insertions(+), 59 deletions(-) diff --git a/.github/workflows/examples-ci.yaml b/.github/workflows/examples-ci.yaml index ddc1035..610628a 100644 --- a/.github/workflows/examples-ci.yaml +++ b/.github/workflows/examples-ci.yaml @@ -28,65 +28,63 @@ jobs: name: Examples CI (${{ matrix.os }}, py-${{ matrix.python-version }}, rdkit=${{ matrix.include-rdkit }}, openeye=${{ matrix.include-openeye }}, dgl=${{ matrix.include-dgl }}), pydantic=${{ matrix.pydantic-version }} runs-on: ${{ matrix.os }} strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - python-version: ["3.11", "3.12"] - pydantic-version: ["2"] - include-rdkit: [true] - include-openeye: [false] - include-dgl: [true] - + fail-fast: false + matrix: + os: [macOS-12, ubuntu-latest] + python-version: ["3.11", "3.12"] + pydantic-version: ["2"] + include-rdkit: [true] + include-openeye: [false] + include-dgl: [true] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + + - name: Build information + run: | + uname -a + df -h + ulimit -a - - name: Build information - run: | - uname -a - df -h - ulimit -a + - name: Install environment + uses: mamba-org/setup-micromamba@v1 + with: + environment-file: devtools/conda-envs/examples_env.yaml + create-args: >- + python=${{ matrix.python-version }} + pydantic=${{ matrix.pydantic-version }} - - name: Install environment - uses: mamba-org/setup-micromamba@v1 - with: - environment-file: devtools/conda-envs/examples_env.yaml - create-args: >- - python=${{ matrix.python-version }} - pydantic=${{ matrix.pydantic-version }} + - name: Install package + run: | + python -m pip install . --no-deps - - name: Install package - run: | - python -m pip install . --no-deps + - uses: ./.github/actions/include-openeye + if: matrix.include-openeye == true + with: + openeye-license-text: ${{ secrets.OE_LICENSE }} + openeye-license-file: ${{ env.OE_LICENSE }} - - uses: ./.github/actions/include-openeye - if: matrix.include-openeye == true - with: - openeye-license-text: ${{ secrets.OE_LICENSE }} - openeye-license-file: ${{ env.OE_LICENSE }} + - name: Uninstall OpenEye + if: matrix.include-openeye == false + run: conda remove --force openeye-toolkits --yes || echo "openeye not installed" - - - name: Uninstall OpenEye - if: matrix.include-openeye == false - run: conda remove --force openeye-toolkits --yes || echo "openeye not installed" + - name: Uninstall RDKit + if: matrix.include-rdkit == false + run: conda remove --force rdkit --yes || echo "rdkit not installed" - - name: Uninstall RDKit - if: matrix.include-rdkit == false - run: conda remove --force rdkit --yes || echo "rdkit not installed" - - - name: Python information - run: | - which python - conda info - conda list + - name: Python information + run: | + which python + conda info + conda list - - name: Check toolkit installations - shell: bash -l -c "python -u {0}" - run: | - from openff.toolkit.utils.toolkits import OPENEYE_AVAILABLE, RDKIT_AVAILABLE - assert str(OPENEYE_AVAILABLE).lower() == '${{ matrix.include-openeye }}' - assert str(RDKIT_AVAILABLE).lower() == '${{ matrix.include-rdkit }}' + - name: Check toolkit installations + shell: bash -l -c "python -u {0}" + run: | + from openff.toolkit.utils.toolkits import OPENEYE_AVAILABLE, RDKIT_AVAILABLE + assert str(OPENEYE_AVAILABLE).lower() == '${{ matrix.include-openeye }}' + assert str(RDKIT_AVAILABLE).lower() == '${{ matrix.include-rdkit }}' - - name: Run example notebooks - run: | - python -m pytest -r fE -v -x --tb=short -nauto --nbval-lax --nbval-cell-timeout=50000 --dist loadscope examples + - name: Run example notebooks + run: | + python -m pytest -r fE -v -x --tb=short -nauto --nbval-lax --dist loadscope examples diff --git a/examples/train-gnn-to-electric-field/train-gnn-to-electric-field.ipynb b/examples/train-gnn-to-electric-field/train-gnn-to-electric-field.ipynb index 2e918cd..a45ae88 100644 --- a/examples/train-gnn-to-electric-field/train-gnn-to-electric-field.ipynb +++ b/examples/train-gnn-to-electric-field/train-gnn-to-electric-field.ipynb @@ -551,7 +551,13 @@ { "cell_type": "markdown", "id": "79cb1d56-3d70-4307-93f0-0d5956fdb32e", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "### Training the model\n", "\n", @@ -562,7 +568,13 @@ "cell_type": "code", "execution_count": 13, "id": "5bfcbce1-8323-4403-a607-89292681375b", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [ "import pytorch_lightning as pl\n", @@ -573,12 +585,18 @@ "cell_type": "code", "execution_count": null, "id": "c8cb0a08-eea6-41e4-9fd6-158204e26e79", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [ "trainer = pl.Trainer(\n", " max_epochs=100,\n", - " callbacks=[TQDMProgressBar()], # add progress bar\n", + " # callbacks=[TQDMProgressBar()], # add progress bar\n", " accelerator=\"cpu\"\n", ")" ] @@ -587,7 +605,13 @@ "cell_type": "code", "execution_count": null, "id": "f8846142-77f2-4d60-a74e-c3bc3c3ed3ee", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [ "datamodule = training_model.create_data_module(verbose=False)" @@ -597,7 +621,13 @@ "cell_type": "code", "execution_count": 14, "id": "4e0174d7-a57b-49d9-89a3-5c756adc0d8c", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [ { "name": "stderr", @@ -2154,7 +2184,14 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.4" + "version": "3.12.7" + }, + "widgets": { + "application/vnd.jupyter.widget-state+json": { + "state": {}, + "version_major": 2, + "version_minor": 0 + } } }, "nbformat": 4, From 69abd328ab798e860770438492947a4063dde596 Mon Sep 17 00:00:00 2001 From: Josh Mitchell Date: Tue, 12 Nov 2024 14:30:34 +1100 Subject: [PATCH 2/8] Undo formatting changes --- .github/workflows/examples-ci.yaml | 102 +++++++++++++++-------------- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/.github/workflows/examples-ci.yaml b/.github/workflows/examples-ci.yaml index 610628a..bacb651 100644 --- a/.github/workflows/examples-ci.yaml +++ b/.github/workflows/examples-ci.yaml @@ -28,63 +28,65 @@ jobs: name: Examples CI (${{ matrix.os }}, py-${{ matrix.python-version }}, rdkit=${{ matrix.include-rdkit }}, openeye=${{ matrix.include-openeye }}, dgl=${{ matrix.include-dgl }}), pydantic=${{ matrix.pydantic-version }} runs-on: ${{ matrix.os }} strategy: - fail-fast: false - matrix: - os: [macOS-12, ubuntu-latest] - python-version: ["3.11", "3.12"] - pydantic-version: ["2"] - include-rdkit: [true] - include-openeye: [false] - include-dgl: [true] + fail-fast: false + matrix: + os: [macOS-12, ubuntu-latest] + python-version: ["3.11", "3.12"] + pydantic-version: ["2"] + include-rdkit: [true] + include-openeye: [false] + include-dgl: [true] - steps: - - uses: actions/checkout@v4 - - name: Build information - run: | - uname -a - df -h - ulimit -a + steps: + - uses: actions/checkout@v4 - - name: Install environment - uses: mamba-org/setup-micromamba@v1 - with: - environment-file: devtools/conda-envs/examples_env.yaml - create-args: >- - python=${{ matrix.python-version }} - pydantic=${{ matrix.pydantic-version }} + - name: Build information + run: | + uname -a + df -h + ulimit -a - - name: Install package - run: | - python -m pip install . --no-deps + - name: Install environment + uses: mamba-org/setup-micromamba@v1 + with: + environment-file: devtools/conda-envs/examples_env.yaml + create-args: >- + python=${{ matrix.python-version }} + pydantic=${{ matrix.pydantic-version }} - - uses: ./.github/actions/include-openeye - if: matrix.include-openeye == true - with: - openeye-license-text: ${{ secrets.OE_LICENSE }} - openeye-license-file: ${{ env.OE_LICENSE }} + - name: Install package + run: | + python -m pip install . --no-deps - - name: Uninstall OpenEye - if: matrix.include-openeye == false - run: conda remove --force openeye-toolkits --yes || echo "openeye not installed" + - uses: ./.github/actions/include-openeye + if: matrix.include-openeye == true + with: + openeye-license-text: ${{ secrets.OE_LICENSE }} + openeye-license-file: ${{ env.OE_LICENSE }} - - name: Uninstall RDKit - if: matrix.include-rdkit == false - run: conda remove --force rdkit --yes || echo "rdkit not installed" + + - name: Uninstall OpenEye + if: matrix.include-openeye == false + run: conda remove --force openeye-toolkits --yes || echo "openeye not installed" - - name: Python information - run: | - which python - conda info - conda list + - name: Uninstall RDKit + if: matrix.include-rdkit == false + run: conda remove --force rdkit --yes || echo "rdkit not installed" + + - name: Python information + run: | + which python + conda info + conda list - - name: Check toolkit installations - shell: bash -l -c "python -u {0}" - run: | - from openff.toolkit.utils.toolkits import OPENEYE_AVAILABLE, RDKIT_AVAILABLE - assert str(OPENEYE_AVAILABLE).lower() == '${{ matrix.include-openeye }}' - assert str(RDKIT_AVAILABLE).lower() == '${{ matrix.include-rdkit }}' + - name: Check toolkit installations + shell: bash -l -c "python -u {0}" + run: | + from openff.toolkit.utils.toolkits import OPENEYE_AVAILABLE, RDKIT_AVAILABLE + assert str(OPENEYE_AVAILABLE).lower() == '${{ matrix.include-openeye }}' + assert str(RDKIT_AVAILABLE).lower() == '${{ matrix.include-rdkit }}' - - name: Run example notebooks - run: | - python -m pytest -r fE -v -x --tb=short -nauto --nbval-lax --dist loadscope examples + - name: Run example notebooks + run: | + python -m pytest -r fE -v -x --tb=short -nauto --nbval-lax --dist loadscope examples From 45e4de111128b1647dcb0f668551dc4b56741675 Mon Sep 17 00:00:00 2001 From: Josh Mitchell Date: Tue, 12 Nov 2024 15:36:40 +1100 Subject: [PATCH 3/8] Disable progress bar in electric field example --- .../train-gnn-to-electric-field.ipynb | 1903 ++++------------- 1 file changed, 368 insertions(+), 1535 deletions(-) diff --git a/examples/train-gnn-to-electric-field/train-gnn-to-electric-field.ipynb b/examples/train-gnn-to-electric-field/train-gnn-to-electric-field.ipynb index a45ae88..8ec653f 100644 --- a/examples/train-gnn-to-electric-field/train-gnn-to-electric-field.ipynb +++ b/examples/train-gnn-to-electric-field/train-gnn-to-electric-field.ipynb @@ -21,7 +21,20 @@ "cell_type": "code", "execution_count": 1, "id": "522bc606-c1aa-4cc7-89da-87440c61f8ba", - "metadata": {}, + "metadata": { + "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:39:01.803451Z", + "iopub.status.busy": "2024-11-12T03:39:01.803352Z", + "iopub.status.idle": "2024-11-12T03:39:04.043969Z", + "shell.execute_reply": "2024-11-12T03:39:04.043614Z", + "shell.execute_reply.started": "2024-11-12T03:39:01.803438Z" + }, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [ "import tqdm\n", @@ -46,7 +59,13 @@ { "cell_type": "markdown", "id": "097895ad-685b-4825-8c22-1a0f79467e9d", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "## Generate and format training data\n", "\n", @@ -59,17 +78,21 @@ "cell_type": "code", "execution_count": 2, "id": "964318ce-9e08-4551-9af4-dc49ea89d027", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "WARNING: This client version is newer than the server version. This may work if the versions are close, but expect exceptions and errors if attempting things the server does not support. client version: 0.56, server version: 0.55\n", - "WARNING: This client version is newer than the server version. This may work if the versions are close, but expect exceptions and errors if attempting things the server does not support. client version: 0.56, server version: 0.55\n" - ] - } - ], + "metadata": { + "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:39:04.044736Z", + "iopub.status.busy": "2024-11-12T03:39:04.044463Z", + "iopub.status.idle": "2024-11-12T03:42:11.995381Z", + "shell.execute_reply": "2024-11-12T03:42:11.995072Z", + "shell.execute_reply.started": "2024-11-12T03:39:04.044721Z" + }, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "outputs": [], "source": [ "qc_client = PortalClient(\"https://api.qcarchive.molssi.org:443\", cache_dir=\".\")\n", "\n", @@ -86,7 +109,13 @@ { "cell_type": "markdown", "id": "54235869-1a60-4945-967d-602ef1f49185", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "### Converting to MoleculeESPRecords\n", "\n", @@ -97,13 +126,26 @@ "cell_type": "code", "execution_count": 3, "id": "25f9db71-4738-4431-9e65-7c0b015b40b4", - "metadata": {}, + "metadata": { + "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:42:11.995906Z", + "iopub.status.busy": "2024-11-12T03:42:11.995798Z", + "iopub.status.idle": "2024-11-12T03:47:20.452022Z", + "shell.execute_reply": "2024-11-12T03:47:20.451739Z", + "shell.execute_reply.started": "2024-11-12T03:42:11.995894Z" + }, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "100%|████████████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [04:36<00:00, 5.52s/it]\n" + "100%|███████████████████████████████████████████████████████████████| 50/50 [05:08<00:00, 6.17s/it]\n" ] } ], @@ -128,7 +170,13 @@ { "cell_type": "markdown", "id": "9dc86d0a-c59e-4f8f-93c7-3b74adb6636e", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "### Convert to PyArrow dataset\n", "\n", @@ -142,13 +190,26 @@ "cell_type": "code", "execution_count": 4, "id": "70634680-8249-49f6-ad24-bc5178851360", - "metadata": {}, + "metadata": { + "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:47:20.452773Z", + "iopub.status.busy": "2024-11-12T03:47:20.452478Z", + "iopub.status.idle": "2024-11-12T03:47:20.578505Z", + "shell.execute_reply": "2024-11-12T03:47:20.578270Z", + "shell.execute_reply.started": "2024-11-12T03:47:20.452758Z" + }, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [00:00<00:00, 447.17it/s]\n" + "100%|██████████████████████████████████████████████████████████████| 50/50 [00:00<00:00, 421.81it/s]\n" ] }, { @@ -161,9 +222,9 @@ "prediction_vector: list\n", " child 0, item: double\n", "----\n", - "mapped_smiles: [[\"[H:1][C:2](=[O:3])[C:4]1=[C:9]([C:7](=[N:6][S:5]1)[Br:8])[Br:10]\",\"[H:1][C:2](=[O:3])[C:4]1=[C:5]([N:7]=[C:8]([N:10]1[H:11])[Br:9])[Br:6]\",\"[H:1][C:2](=[O:3])[C:4]1=[C:10]([N:8]([C:6](=[N:5]1)[Br:7])[H:9])[Br:11]\",\"[H:1][C:2](=[O:3])[C:4]1=[C:9]([S:8][N:7]=[C:5]1[Br:6])[Br:10]\",\"[H:1][C:2](=[O:3])[C:4]1=[N:5][S:6][C:7](=[C:9]1[Br:10])[Br:8]\",...,\"[H:4][c:3]1[c:2]([c:20]([c:18]([c:16]([c:5]1[C:6]([H:7])([C:8]([H:9])([H:10])[H:11])[N+:12]([H:13])([H:14])[H:15])[Br:17])[H:19])[Br:21])[H:1]\",\"[H:1][c:2]1[c:19]([c:9]([c:7]([c:5]([c:3]1[H:4])[Br:6])[Br:8])[C:10]([H:11])([C:15]([H:16])([H:17])[H:18])[N:12]([H:13])[H:14])[H:20]\",\"[H:1][c:2]1[c:20]([c:9]([c:7]([c:5]([c:3]1[H:4])[Br:6])[Br:8])[C:10]([H:11])([C:12]([H:13])([H:14])[H:15])[N+:16]([H:17])([H:18])[H:19])[H:21]\",\"[H:4][c:3]1[c:2]([c:22]([c:20]([c:18]([c:5]1[C:6]([H:7])([H:8])[N:9]([H:10])[C:11]([H:12])([H:13])[C:14]([H:15])([H:16])[H:17])[H:19])[Br:21])[Br:23])[H:1]\",\"[H:4][c:3]1[c:2]([c:22]([c:20]([c:18]([c:5]1[C:6]([H:7])([H:8])[N:9]([H:10])[C:11]([H:12])([H:13])[C:14]([H:15])([H:16])[H:17])[H:19])[Br:21])[Br:23])[H:1]\"]]\n", - "precursor_matrix: [[[0.5268278695916089,0.3663918376587872,0.30209382642805216,0.24952373167995737,0.20284281127461076,...,0.12682386926954425,0.17299639848680223,0.14835260748248824,0.22417394022165082,0.31729613836761544],[0.5459961499174945,0.3811772132544467,0.310495392830858,0.26421186900748445,0.16815883207694643,...,0.1959073125648948,0.2712204910932398,0.2018013854288873,0.3843880654806236,0.5473435022093819],...,[0.5188600228738232,0.36372757615732326,0.27049010438839094,0.2625940436429743,0.1744397734479557,...,0.10263580193044784,0.18779157315897135,0.16465862132957662,0.24504157435453747,0.34126749604041895],[0.523471022948499,0.3711542616380526,0.2768487697745459,0.26502768742612426,0.17897523760699538,...,0.10483875445263033,0.18971891584707673,0.16387162999092086,0.24867226425516173,0.3443168978222578]]]\n", - "prediction_vector: [[[0.06806112259081701,0.030716434587978025,-0.016729472006731878,0.029951025414986638,0.029496272551505647,-0.0024857716639207815,0.005087538225819736,-0.004348276082205866,0.013868185380437326,-0.0003752919418263855],[0.06562099527752072,0.022540831241458854,-0.03627159213493826,0.030697369204467136,-0.003824835345860035,-0.022952256996058556,-0.013973378103473662,0.024411442114600782,0.020922857209616338,0.06615881080418917,0.12160304322089216],...,[0.022271980401278424,0.0056816366203780245,0.016862184483462814,0.036808512643687834,0.013646974537450432,...,0.0024587377823627682,-0.015963611907693187,-0.028345562608464187,-0.014267070720150517,-0.0268968083285119],[0.020751052712825666,0.0033002036503013057,0.009596814898405207,0.01807019115329054,0.01444660212469153,...,0.02400538665376119,-0.013272983985162003,-0.026300857709583143,-0.01412185316045618,-0.026633251145107114]]]" + "mapped_smiles: [[\"[H:1][C:2](=[O:3])[C:4]1=[C:9]([Br:10])[C:7]([Br:8])=[N:6][S:5]1\",\"[H:1][C:2](=[O:3])[C:4]1=[C:5]([Br:6])[N:7]=[C:8]([Br:9])[N:10]1[H:11]\",\"[H:1][C:2](=[O:3])[C:4]1=[C:10]([Br:11])[N:8]([H:9])[C:6]([Br:7])=[N:5]1\",\"[H:1][C:2](=[O:3])[C:4]1=[C:9]([Br:10])[S:8][N:7]=[C:5]1[Br:6]\",\"[H:1][C:2](=[O:3])[C:4]1=[N:5][S:6][C:7]([Br:8])=[C:9]1[Br:10]\",...,\"[H:1][c:2]1[c:3]([H:4])[c:5]([C:6]([H:7])([C:8]([H:9])([H:10])[H:11])[N+:12]([H:13])([H:14])[H:15])[c:16]([Br:17])[c:18]([H:19])[c:20]1[Br:21]\",\"[H:1][c:2]1[c:3]([H:4])[c:5]([Br:6])[c:7]([Br:8])[c:9]([C:10]([H:11])([N:12]([H:13])[H:14])[C:15]([H:16])([H:17])[H:18])[c:19]1[H:20]\",\"[H:1][c:2]1[c:3]([H:4])[c:5]([Br:6])[c:7]([Br:8])[c:9]([C:10]([H:11])([C:12]([H:13])([H:14])[H:15])[N+:16]([H:17])([H:18])[H:19])[c:20]1[H:21]\",\"[H:1][c:2]1[c:3]([H:4])[c:5]([C:6]([H:7])([H:8])[N:9]([H:10])[C:11]([H:12])([H:13])[C:14]([H:15])([H:16])[H:17])[c:18]([H:19])[c:20]([Br:21])[c:22]1[Br:23]\",\"[H:1][c:2]1[c:3]([H:4])[c:5]([C:6]([H:7])([H:8])[N:9]([H:10])[C:11]([H:12])([H:13])[C:14]([H:15])([H:16])[H:17])[c:18]([H:19])[c:20]([Br:21])[c:22]1[Br:23]\"]]\n", + "precursor_matrix: [[[0.5268278695916088,0.3663918376587869,0.30209382642805216,0.2495237316799569,0.20284281127461032,...,0.12682386926954417,0.1729963984868022,0.14835260748248816,0.22417394022165088,0.3172961383676153],[0.5459961499174948,0.3811772132544468,0.3104953928308583,0.26421186900748456,0.16815883207694643,...,0.19590731256489477,0.2712204910932398,0.20180138542888734,0.3843880654806236,0.547343502209382],...,[0.5188600228738238,0.36372757615732254,0.2704901043883896,0.26259404364297456,0.174439773447956,...,0.10263580193044784,0.18779157315897133,0.1646586213295766,0.24504157435453758,0.34126749604041884],[0.5234710229484995,0.3711542616380525,0.27684876977454587,0.26502768742612326,0.1789752376069953,...,0.1048387544526304,0.18971891584707684,0.16387162999092092,0.24867226425516167,0.3443168978222574]]]\n", + "prediction_vector: [[[0.06806112259087671,0.030716434588028432,-0.01672947200663685,0.029951025414965547,0.029496272551447888,-0.0024857716640091427,0.005087538225717987,-0.0043482760823769845,0.013868185380384116,-0.00037529194184321565],[0.06562099527727273,0.022540831241202333,-0.036271592135264416,0.030697369204302098,-0.003824835345960371,-0.022952256996007787,-0.013973378103587722,0.02441144211448937,0.02092285720950078,0.06615881080407054,0.12160304322077782],...,[0.022271980401070538,0.005681636620152487,0.016862184483217153,0.03680851264345411,0.013646974537191332,...,0.002458737782103706,-0.015963611907879226,-0.02834556260852975,-0.014267070720346707,-0.026896808328652506],[0.02075105271295132,0.0033002036504139556,0.009596814898498528,0.018070191153379336,0.014446602124759561,...,0.0240053866538266,-0.013272983985113784,-0.02630085770960776,-0.01412185316036113,-0.02663325114497883]]]" ] }, "execution_count": 4, @@ -219,7 +280,20 @@ "cell_type": "code", "execution_count": 5, "id": "72a9cdce-5411-4fe3-b2ea-46fb63e09d2c", - "metadata": {}, + "metadata": { + "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:47:20.578981Z", + "iopub.status.busy": "2024-11-12T03:47:20.578866Z", + "iopub.status.idle": "2024-11-12T03:47:20.582474Z", + "shell.execute_reply": "2024-11-12T03:47:20.582244Z", + "shell.execute_reply.started": "2024-11-12T03:47:20.578968Z" + }, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [ "pq.write_table(training_table, \"training_dataset_table.parquet\")\n", @@ -233,7 +307,13 @@ { "cell_type": "markdown", "id": "4682e8cb-fba8-4cec-97b0-4d996e24ecf9", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "## Set up for training a GNN" ] @@ -242,7 +322,20 @@ "cell_type": "code", "execution_count": 6, "id": "3d3c909f-c1b9-44e0-86e0-d4ccf6ceb996", - "metadata": {}, + "metadata": { + "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:47:20.583457Z", + "iopub.status.busy": "2024-11-12T03:47:20.583351Z", + "iopub.status.idle": "2024-11-12T03:47:21.655807Z", + "shell.execute_reply": "2024-11-12T03:47:21.655393Z", + "shell.execute_reply.started": "2024-11-12T03:47:20.583445Z" + }, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [ "from openff.nagl.config import (\n", @@ -270,7 +363,13 @@ { "cell_type": "markdown", "id": "88be032d-0101-479e-a468-2c5db34600fc", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "### Defining the training config\n", "\n", @@ -284,7 +383,20 @@ "cell_type": "code", "execution_count": 7, "id": "f7ddfbde-1349-42ec-a2aa-0f9ead097e99", - "metadata": {}, + "metadata": { + "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:47:21.656481Z", + "iopub.status.busy": "2024-11-12T03:47:21.656171Z", + "iopub.status.idle": "2024-11-12T03:47:21.659526Z", + "shell.execute_reply": "2024-11-12T03:47:21.659243Z", + "shell.execute_reply.started": "2024-11-12T03:47:21.656466Z" + }, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [ "atom_features = [\n", @@ -342,7 +454,13 @@ { "cell_type": "markdown", "id": "a68f7b57-a1f7-43f4-ba2d-9579dd9562db", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "#### Defining a DataConfig\n", "\n", @@ -353,7 +471,20 @@ "cell_type": "code", "execution_count": 8, "id": "bf524fad-42e5-4020-a9d9-90a56343b7a1", - "metadata": {}, + "metadata": { + "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:47:21.660004Z", + "iopub.status.busy": "2024-11-12T03:47:21.659897Z", + "iopub.status.idle": "2024-11-12T03:47:21.668487Z", + "shell.execute_reply": "2024-11-12T03:47:21.668229Z", + "shell.execute_reply.started": "2024-11-12T03:47:21.659991Z" + }, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [ "target = GeneralLinearFitTarget(\n", @@ -392,7 +523,13 @@ { "cell_type": "markdown", "id": "cfd8bba9-241c-4c67-8f88-a89ae608ec89", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "#### Defining an OptimizerConfig\n", "\n", @@ -403,7 +540,20 @@ "cell_type": "code", "execution_count": 9, "id": "1759ed0f-2e89-4d22-80ae-2c0ba04f37a0", - "metadata": {}, + "metadata": { + "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:47:21.668916Z", + "iopub.status.busy": "2024-11-12T03:47:21.668809Z", + "iopub.status.idle": "2024-11-12T03:47:21.676788Z", + "shell.execute_reply": "2024-11-12T03:47:21.676523Z", + "shell.execute_reply.started": "2024-11-12T03:47:21.668903Z" + }, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [ "optimizer_config = OptimizerConfig(optimizer=\"Adam\", learning_rate=0.001)" @@ -412,7 +562,13 @@ { "cell_type": "markdown", "id": "7c784871-e834-470e-a346-bde893326fee", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "#### Creating a TrainingConfig" ] @@ -421,7 +577,20 @@ "cell_type": "code", "execution_count": 10, "id": "f5958818-03ef-4580-9cbf-c588cbb3141f", - "metadata": {}, + "metadata": { + "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:47:21.677234Z", + "iopub.status.busy": "2024-11-12T03:47:21.677133Z", + "iopub.status.idle": "2024-11-12T03:47:21.684364Z", + "shell.execute_reply": "2024-11-12T03:47:21.684055Z", + "shell.execute_reply.started": "2024-11-12T03:47:21.677222Z" + }, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [], "source": [ "training_config = TrainingConfig(\n", @@ -434,7 +603,13 @@ { "cell_type": "markdown", "id": "17d61258-fe16-4993-9c19-57118c9d0a1a", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "### Creating a TrainingGNNModel\n", "\n", @@ -445,7 +620,20 @@ "cell_type": "code", "execution_count": 11, "id": "3eefcea4-2e9a-4e4a-b3fc-939f3f733fb8", - "metadata": {}, + "metadata": { + "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:47:21.684805Z", + "iopub.status.busy": "2024-11-12T03:47:21.684705Z", + "iopub.status.idle": "2024-11-12T03:47:21.919136Z", + "shell.execute_reply": "2024-11-12T03:47:21.918838Z", + "shell.execute_reply.started": "2024-11-12T03:47:21.684792Z" + }, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [ { "data": { @@ -502,7 +690,13 @@ { "cell_type": "markdown", "id": "d696dae6-93ce-4f0a-ab0f-ebb7e72fa176", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ "We can look at the initial capabilities of the model by comparing its charges to AM1-BCC charges. They're pretty bad." ] @@ -511,14 +705,27 @@ "cell_type": "code", "execution_count": 12, "id": "adb99158-fa97-412d-972b-89f6f563b84a", - "metadata": {}, + "metadata": { + "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:47:21.919640Z", + "iopub.status.busy": "2024-11-12T03:47:21.919528Z", + "iopub.status.idle": "2024-11-12T03:47:22.209956Z", + "shell.execute_reply": "2024-11-12T03:47:22.209704Z", + "shell.execute_reply.started": "2024-11-12T03:47:21.919625Z" + }, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "outputs": [ { "data": { "text/plain": [ - "array([-0.0422502 , -0.05428261, 0.15142802, -0.42682151, 0.09391647,\n", - " 0.09391647, 0.09391647, 0.2050635 , 0.2050635 , -0.15997499,\n", - " -0.15997499])" + "array([-0.07757042, -0.04149809, -0.05459142, -0.10976206, 0.02205708,\n", + " 0.02205708, 0.02205708, -0.22072439, -0.22072439, 0.3293481 ,\n", + " 0.3293481 ])" ] }, "execution_count": 12, @@ -570,6 +777,13 @@ "id": "5bfcbce1-8323-4403-a607-89292681375b", "metadata": { "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:47:22.210455Z", + "iopub.status.busy": "2024-11-12T03:47:22.210338Z", + "iopub.status.idle": "2024-11-12T03:47:22.212075Z", + "shell.execute_reply": "2024-11-12T03:47:22.211832Z", + "shell.execute_reply.started": "2024-11-12T03:47:22.210441Z" + }, "slideshow": { "slide_type": "" }, @@ -583,30 +797,54 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "c8cb0a08-eea6-41e4-9fd6-158204e26e79", "metadata": { "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:47:22.212508Z", + "iopub.status.busy": "2024-11-12T03:47:22.212401Z", + "iopub.status.idle": "2024-11-12T03:47:22.230803Z", + "shell.execute_reply": "2024-11-12T03:47:22.230576Z", + "shell.execute_reply.started": "2024-11-12T03:47:22.212495Z" + }, "slideshow": { "slide_type": "" }, "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "INFO:pytorch_lightning.utilities.rank_zero:GPU available: False, used: False\n", + "INFO:pytorch_lightning.utilities.rank_zero:TPU available: False, using: 0 TPU cores\n", + "INFO:pytorch_lightning.utilities.rank_zero:HPU available: False, using: 0 HPUs\n" + ] + } + ], "source": [ "trainer = pl.Trainer(\n", " max_epochs=100,\n", - " # callbacks=[TQDMProgressBar()], # add progress bar\n", - " accelerator=\"cpu\"\n", + " accelerator=\"cpu\",\n", + " enable_progress_bar=False, # Comment this out to monitor progress\n", ")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "f8846142-77f2-4d60-a74e-c3bc3c3ed3ee", "metadata": { "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:47:22.231217Z", + "iopub.status.busy": "2024-11-12T03:47:22.231114Z", + "iopub.status.idle": "2024-11-12T03:47:22.232787Z", + "shell.execute_reply": "2024-11-12T03:47:22.232524Z", + "shell.execute_reply.started": "2024-11-12T03:47:22.231204Z" + }, "slideshow": { "slide_type": "" }, @@ -619,10 +857,17 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 16, "id": "4e0174d7-a57b-49d9-89a3-5c756adc0d8c", "metadata": { "editable": true, + "execution": { + "iopub.execute_input": "2024-11-12T03:47:22.233391Z", + "iopub.status.busy": "2024-11-12T03:47:22.233232Z", + "iopub.status.idle": "2024-11-12T03:47:47.501666Z", + "shell.execute_reply": "2024-11-12T03:47:47.501347Z", + "shell.execute_reply.started": "2024-11-12T03:47:22.233369Z" + }, "slideshow": { "slide_type": "" }, @@ -633,27 +878,30 @@ "name": "stderr", "output_type": "stream", "text": [ - "GPU available: True (mps), used: False\n", - "TPU available: False, using: 0 TPU cores\n", - "HPU available: False, using: 0 HPUs\n", - "/Users/lily/micromamba/envs/train-gnn-to-electric-field/lib/python3.12/site-packages/pytorch_lightning/trainer/setup.py:177: GPU available but not used. You can set it by doing `Trainer(accelerator='gpu')`.\n", "Featurizing dataset: 0it [00:00, ?it/s]\n", - "Featurizing batch: 0%| | 0/40 [00:00 Date: Tue, 12 Nov 2024 15:39:11 +1100 Subject: [PATCH 4/8] Use macos-latest instead of macos-12 --- .github/workflows/examples-ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/examples-ci.yaml b/.github/workflows/examples-ci.yaml index bacb651..cda1c20 100644 --- a/.github/workflows/examples-ci.yaml +++ b/.github/workflows/examples-ci.yaml @@ -30,7 +30,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macOS-12, ubuntu-latest] + os: [macOS-latest, ubuntu-latest] python-version: ["3.11", "3.12"] pydantic-version: ["2"] include-rdkit: [true] From 691ebfff5ac41dc140467760f10fdd0642e66009 Mon Sep 17 00:00:00 2001 From: Josh Mitchell Date: Tue, 12 Nov 2024 16:23:04 +1100 Subject: [PATCH 5/8] conda -> micromamba in examples CI --- .github/workflows/examples-ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/examples-ci.yaml b/.github/workflows/examples-ci.yaml index cda1c20..7119b45 100644 --- a/.github/workflows/examples-ci.yaml +++ b/.github/workflows/examples-ci.yaml @@ -68,17 +68,17 @@ jobs: - name: Uninstall OpenEye if: matrix.include-openeye == false - run: conda remove --force openeye-toolkits --yes || echo "openeye not installed" + run: micromamba remove --force openeye-toolkits --yes || echo "openeye not installed" - name: Uninstall RDKit if: matrix.include-rdkit == false - run: conda remove --force rdkit --yes || echo "rdkit not installed" + run: micromamba remove --force rdkit --yes || echo "rdkit not installed" - name: Python information run: | which python - conda info - conda list + micromamba info + micromamba list - name: Check toolkit installations shell: bash -l -c "python -u {0}" From 2d183ded91ad2eaf0a8abb35c2417a6fa7623f0a Mon Sep 17 00:00:00 2001 From: Josh Mitchell Date: Tue, 12 Nov 2024 16:48:23 +1100 Subject: [PATCH 6/8] Update setup-micromamba to v2 --- .github/workflows/examples-ci.yaml | 102 ++++++++++++++--------------- 1 file changed, 50 insertions(+), 52 deletions(-) diff --git a/.github/workflows/examples-ci.yaml b/.github/workflows/examples-ci.yaml index 7119b45..3546574 100644 --- a/.github/workflows/examples-ci.yaml +++ b/.github/workflows/examples-ci.yaml @@ -28,65 +28,63 @@ jobs: name: Examples CI (${{ matrix.os }}, py-${{ matrix.python-version }}, rdkit=${{ matrix.include-rdkit }}, openeye=${{ matrix.include-openeye }}, dgl=${{ matrix.include-dgl }}), pydantic=${{ matrix.pydantic-version }} runs-on: ${{ matrix.os }} strategy: - fail-fast: false - matrix: - os: [macOS-latest, ubuntu-latest] - python-version: ["3.11", "3.12"] - pydantic-version: ["2"] - include-rdkit: [true] - include-openeye: [false] - include-dgl: [true] - + fail-fast: false + matrix: + os: [macOS-latest, ubuntu-latest] + python-version: ["3.11", "3.12"] + pydantic-version: ["2"] + include-rdkit: [true] + include-openeye: [false] + include-dgl: [true] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + + - name: Build information + run: | + uname -a + df -h + ulimit -a - - name: Build information - run: | - uname -a - df -h - ulimit -a + - name: Install environment + uses: mamba-org/setup-micromamba@v2 + with: + environment-file: devtools/conda-envs/examples_env.yaml + create-args: >- + python=${{ matrix.python-version }} + pydantic=${{ matrix.pydantic-version }} - - name: Install environment - uses: mamba-org/setup-micromamba@v1 - with: - environment-file: devtools/conda-envs/examples_env.yaml - create-args: >- - python=${{ matrix.python-version }} - pydantic=${{ matrix.pydantic-version }} + - name: Install package + run: | + python -m pip install . --no-deps - - name: Install package - run: | - python -m pip install . --no-deps + - uses: ./.github/actions/include-openeye + if: matrix.include-openeye == true + with: + openeye-license-text: ${{ secrets.OE_LICENSE }} + openeye-license-file: ${{ env.OE_LICENSE }} - - uses: ./.github/actions/include-openeye - if: matrix.include-openeye == true - with: - openeye-license-text: ${{ secrets.OE_LICENSE }} - openeye-license-file: ${{ env.OE_LICENSE }} + - name: Uninstall OpenEye + if: matrix.include-openeye == false + run: micromamba remove --force openeye-toolkits --yes || echo "openeye not installed" - - - name: Uninstall OpenEye - if: matrix.include-openeye == false - run: micromamba remove --force openeye-toolkits --yes || echo "openeye not installed" + - name: Uninstall RDKit + if: matrix.include-rdkit == false + run: micromamba remove --force rdkit --yes || echo "rdkit not installed" - - name: Uninstall RDKit - if: matrix.include-rdkit == false - run: micromamba remove --force rdkit --yes || echo "rdkit not installed" - - - name: Python information - run: | - which python - micromamba info - micromamba list + - name: Python information + run: | + which python + micromamba info + micromamba list - - name: Check toolkit installations - shell: bash -l -c "python -u {0}" - run: | - from openff.toolkit.utils.toolkits import OPENEYE_AVAILABLE, RDKIT_AVAILABLE - assert str(OPENEYE_AVAILABLE).lower() == '${{ matrix.include-openeye }}' - assert str(RDKIT_AVAILABLE).lower() == '${{ matrix.include-rdkit }}' + - name: Check toolkit installations + shell: bash -l -c "python -u {0}" + run: | + from openff.toolkit.utils.toolkits import OPENEYE_AVAILABLE, RDKIT_AVAILABLE + assert str(OPENEYE_AVAILABLE).lower() == '${{ matrix.include-openeye }}' + assert str(RDKIT_AVAILABLE).lower() == '${{ matrix.include-rdkit }}' - - name: Run example notebooks - run: | - python -m pytest -r fE -v -x --tb=short -nauto --nbval-lax --dist loadscope examples + - name: Run example notebooks + run: | + python -m pytest -r fE -v -x --tb=short -nauto --nbval-lax --dist loadscope examples From 75adacad418b9163053038531d0fc6f91ae15ef0 Mon Sep 17 00:00:00 2001 From: Josh Mitchell Date: Tue, 12 Nov 2024 16:48:52 +1100 Subject: [PATCH 7/8] Remove defaults channel from examples environment --- devtools/conda-envs/examples_env.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/devtools/conda-envs/examples_env.yaml b/devtools/conda-envs/examples_env.yaml index e0d83e0..eabe063 100644 --- a/devtools/conda-envs/examples_env.yaml +++ b/devtools/conda-envs/examples_env.yaml @@ -1,7 +1,6 @@ name: openff-nagl-test channels: - conda-forge - - defaults dependencies: # Base depends - python @@ -42,7 +41,6 @@ dependencies: # compatibility - apsw >=3.42 - # CI - nbval - pytest From 8870d78ad2232755eb34f8e16c7dabe6b41ba51f Mon Sep 17 00:00:00 2001 From: Lily Wang Date: Tue, 12 Nov 2024 18:37:24 +1100 Subject: [PATCH 8/8] try telling pytorch not to use mps --- .github/workflows/examples-ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/examples-ci.yaml b/.github/workflows/examples-ci.yaml index 3546574..70eb31b 100644 --- a/.github/workflows/examples-ci.yaml +++ b/.github/workflows/examples-ci.yaml @@ -22,6 +22,7 @@ defaults: env: OE_LICENSE: ${{ github.workspace }}/oe_license.txt + PYTORCH_ENABLE_MPS_FALLBACK: 0 jobs: example_tests: