Skip to content

Commit f845c10

Browse files
committed
[fix] (Hopefully) fixed GitHub Action for CI
1 parent 9f3bc7d commit f845c10

File tree

14 files changed

+127
-38
lines changed

14 files changed

+127
-38
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ permissions:
1111
env:
1212
ENV_NAME: aenet-torch
1313
PYTHON_VERSION: "3.11"
14+
TORCH_VERSION: "2.9.0"
15+
PYG_WHEEL_URL: "https://data.pyg.org/whl/torch-2.9.0+cpu.html"
1416

1517
jobs:
1618
unit-tests:
@@ -35,7 +37,10 @@ jobs:
3537
- name: Install project and dependencies
3638
run: |
3739
micromamba run -n "${ENV_NAME}" python -m pip install --upgrade pip
38-
micromamba run -n "${ENV_NAME}" python -m pip install -e ".[dev,torch]"
40+
micromamba run -n "${ENV_NAME}" python -m pip install -e ".[dev]"
41+
micromamba run -n "${ENV_NAME}" python -m pip install "torch==${TORCH_VERSION}"
42+
micromamba run -n "${ENV_NAME}" python -m pip install \
43+
torch-scatter torch-cluster -f "${PYG_WHEEL_URL}"
3944
4045
- name: Run general pytest suite
4146
run: |
@@ -63,7 +68,10 @@ jobs:
6368
- name: Install project and dependencies
6469
run: |
6570
micromamba run -n "${ENV_NAME}" python -m pip install --upgrade pip
66-
micromamba run -n "${ENV_NAME}" python -m pip install -e ".[dev,torch]"
71+
micromamba run -n "${ENV_NAME}" python -m pip install -e ".[dev]"
72+
micromamba run -n "${ENV_NAME}" python -m pip install "torch==${TORCH_VERSION}"
73+
micromamba run -n "${ENV_NAME}" python -m pip install \
74+
torch-scatter torch-cluster -f "${PYG_WHEEL_URL}"
6775
6876
- name: Run pytest docs examples
6977
run: |
@@ -115,7 +123,10 @@ jobs:
115123
- name: Install project and dependencies
116124
run: |
117125
micromamba run -n "${ENV_NAME}" python -m pip install --upgrade pip
118-
micromamba run -n "${ENV_NAME}" python -m pip install -e ".[dev,torch]"
126+
micromamba run -n "${ENV_NAME}" python -m pip install -e ".[dev]"
127+
micromamba run -n "${ENV_NAME}" python -m pip install "torch==${TORCH_VERSION}"
128+
micromamba run -n "${ENV_NAME}" python -m pip install \
129+
torch-scatter torch-cluster -f "${PYG_WHEEL_URL}"
119130
120131
- name: Prepare disposable notebook worktree
121132
run: |

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,44 @@ For development, install in editable mode:
2424

2525
Optional: enable PyTorch-based features (featurization and training)
2626

27-
- From a source checkout:
27+
Installation matrix:
28+
29+
- Core PyTorch support only
30+
31+
$ pip install '.[torch]'
32+
33+
This is sufficient for the core `aenet.torch_training` API, but not for the
34+
PyG-backed featurization and neighbor-list stack.
35+
36+
- Full CPU PyTorch stack (recommended for docs examples and notebooks)
2837

2938
$ pip install '.[torch]'
39+
$ pip install torch-scatter torch-cluster -f https://data.pyg.org/whl/torch-${TORCH}+cpu.html
3040

31-
or for development:
41+
- Full CUDA PyTorch stack
3242

33-
$ pip install -e '.[dev,torch]'
43+
$ pip install '.[torch]'
44+
$ pip install torch-scatter torch-cluster -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html
45+
46+
- Development install with the full CPU stack
47+
48+
$ pip install -e '.[dev]'
49+
$ pip install '.[torch]'
50+
$ pip install torch-scatter torch-cluster -f https://data.pyg.org/whl/torch-${TORCH}+cpu.html
3451

3552
If pip reports build/version conflicts for torch-scatter/torch-cluster:
3653
- Ensure your installed torch version matches available wheels (CPU/CUDA).
3754
- You can install prebuilt wheels from the PyG index, for example:
3855

3956
$ pip install torch-scatter torch-cluster -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html
4057

41-
Replace ${TORCH} (e.g., 2.3.1) and ${CUDA} (e.g., cu121 or cpu) with your environment.
58+
Replace ${TORCH} (for example, 2.9.0) and ${CUDA} (for example, cu124 or
59+
cpu) with your environment.
4260

4361
Behavior without PyTorch extras:
44-
- aenet.torch_featurize and aenet.torch_training can be imported, but accessing symbols raises a clear ImportError suggesting: pip install 'aenet[torch]'.
62+
- aenet.torch_featurize and PyG-backed training workflows can be imported, but
63+
accessing symbols raises a clear ImportError with guidance to install core
64+
torch plus matching `torch-scatter` / `torch-cluster` wheels.
4565
- AtomicStructure.get_neighbors() automatically falls back to a NumPy neighbor list with a RuntimeWarning.
4666

4767
To use the featurization capabilities, the main ænet package needs to be installed separately as described [elsewhere](http://ann.atomistic.net/documentation/). And `aenet-python` needs to be made aware of the ænet installation path, for example, using its interactive configuration tool

docs/source/dev/neighbor_lists.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ and optional GPU execution, see ``notebooks/example-07-neighbor-list.ipynb``.
1616
.. note::
1717

1818
The features described here make use of PyTorch. Make sure to
19-
install ænet with the ``[torch]`` extra as described in
20-
:doc:`/usage/installation`. For use without PyTorch, ``aenet-python`` also
21-
provides a (less efficient) pure-Python neighbor list implementation in
22-
``aenet.geometry.nblist``, which can be used with ``AtomicStructure``
23-
objects.
19+
install core torch support plus the matching ``torch-scatter`` and
20+
``torch-cluster`` wheels as described in :doc:`/usage/installation`. For
21+
use without PyTorch, ``aenet-python`` also provides a (less efficient)
22+
pure-Python neighbor list implementation in ``aenet.geometry.nblist``,
23+
which can be used with ``AtomicStructure`` objects.
2424

2525
Quick Start
2626
-----------

docs/source/usage/installation.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,36 @@ explicitly with
3838

3939
$ pip install ".[torch]"
4040

41+
This installs the core PyTorch dependency only. The PyTorch-based
42+
featurization and neighbor-list features also require the PyG extension
43+
packages ``torch-scatter`` and ``torch-cluster`` matched to the local torch
44+
build.
45+
46+
Recommended installation matrix:
47+
48+
.. sourcecode:: console
49+
50+
# Core PyTorch support only
51+
$ pip install ".[torch]"
52+
53+
# Full CPU PyTorch stack
54+
$ pip install ".[torch]"
55+
$ pip install torch-scatter torch-cluster -f https://data.pyg.org/whl/torch-${TORCH}+cpu.html
56+
57+
# Full CUDA PyTorch stack
58+
$ pip install ".[torch]"
59+
$ pip install torch-scatter torch-cluster -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html
60+
61+
Replace ``${TORCH}`` with the installed torch version (for example ``2.9.0``)
62+
and ``${CUDA}`` with the matching CUDA tag (for example ``cu124``). If you
63+
are developing from a source checkout, the equivalent editable install is:
64+
65+
.. sourcecode:: console
66+
67+
$ pip install -e ".[dev]"
68+
$ pip install ".[torch]"
69+
$ pip install torch-scatter torch-cluster -f https://data.pyg.org/whl/torch-${TORCH}+cpu.html
70+
4171

4272
2. Configure ænet Fortran Binaries
4373
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

docs/source/usage/torch_featurization.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ PyTorch-Based Featurization
44
.. note::
55

66
Featurization as described here makes use of PyTorch. Make sure to
7-
install ænet with the ``[torch]`` extra as described in :doc:`installation`.
7+
install core torch support plus the matching ``torch-scatter`` and
8+
``torch-cluster`` wheels as described in :doc:`installation`.
89

910
.. note::
1011

docs/source/usage/torch_inference.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ Using ANN Potentials with the PyTorch Implementation
66
.. note::
77

88
Inference as described here makes use of PyTorch. Make sure to
9-
install ænet with the ``[torch]`` extra as described in :doc:`installation`.
9+
install core torch support as described in :doc:`installation`. The
10+
descriptor-backed workflows shown here also rely on the matching
11+
``torch-scatter`` and ``torch-cluster`` wheels.
1012

1113
.. note::
1214

docs/source/usage/torch_training.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ and automatic differentiation for forces.
99
.. note::
1010

1111
Training as described here makes use of PyTorch. Make sure to
12-
install ænet with the ``[torch]`` extra as described in :doc:`installation`.
12+
install core torch support as described in :doc:`installation`. Most
13+
descriptor-based training workflows also require the matching
14+
``torch-scatter`` and ``torch-cluster`` wheels.
1315

1416
.. note::
1517

notebooks/example-04-torch-featurization.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"source": [
77
"# PyTorch Featurization\n",
88
"\n",
9-
"**Note: `aenet-python` needs to be installed with the `[torch]` requirements (`pip install aenet[torch]`) for this notebook to work.**\n",
9+
"**Note: `aenet-python` needs core torch support (`pip install aenet[torch]`) plus matching `torch-scatter` and `torch-cluster` wheels from `https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html` for this notebook to work.**\n",
1010
"\n",
1111
"This notebook demonstrates the longer PyTorch featurization workflows that complement the compact CPU-only examples in `docs/source/usage/torch_featurization.rst`, including file-based input, batch processing, optional GPU execution, and gradient computation."
1212
]

notebooks/example-05-torch-training.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"source": [
88
"# Training with PyTorch\n",
99
"\n",
10-
"**Note:** `aenet-python` needs to be installed with the `[torch]` requirements (`pip install aenet[torch]`) for this notebook to work.\n",
10+
"**Note:** `aenet-python` needs core torch support (`pip install aenet[torch]`) plus matching `torch-scatter` and `torch-cluster` wheels from `https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html` for this notebook to work.\n",
1111
"\n",
1212
"This notebook demonstrates end-to-end PyTorch training on the TiO2 example set.\n",
1313
"It demonstrates file-backed workflows, explicit `CachedStructureDataset` usage, and\n",

notebooks/example-06-torch-inference.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"source": [
88
"# Inference with the PyTorch implementation\n",
99
"\n",
10-
"**Note: `aenet-python` needs to be installed with the `[torch]` requirements (`pip install aenet[torch]`) for this notebook to work.**\n",
10+
"**Note: `aenet-python` needs core torch support (`pip install aenet[torch]`) plus matching `torch-scatter` and `torch-cluster` wheels from `https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html` for this notebook to work.**\n",
1111
"\n",
1212
"Predicting energies and forces with the PyTorch API is nearly identical to the Fortran/Python API."
1313
]

0 commit comments

Comments
 (0)