You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 36d3592
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,13 +10,9 @@ Deep learning for theoretical X-ray spectroscopy.
10
10
11
11
</div>
12
12
13
-
<divalign="center">
14
-
<strong>This README is a work in progress.</strong>
15
-
</div>
16
-
17
13
## Overview
18
14
19
-
We present XANESNET, a PyTorch-based, open-source software framework for machine learning in spectroscopy. The framework integrates training, inference, and automated analysis within a plugin-based architecture. Its modular design allows users to compare, combine, and extend different methods without modifying the core codebase, providing a flexible and reusable framework rather than a single-purpose implementation. XANESNET supports forward prediction from structure to spectrum and inverse inference from spectra to structures or properties. A unified data pipeline uniformly handles molecular and periodic systems, while the framework remains agnostic to the spectroscopic technique. We demonstrate its use for learning structure-spectrum relationships in X-ray absorption spectroscopy. By prioritizing extensibility and reproducibility, XANESNET aims to accelerate and make more accessible machine-learning research in spectroscopy.
15
+
We present XANESNET, an open-source, PyTorch-based software package for machine learning in spectroscopy. Specifically, the framework integrates training, inference, and automated analysis for structure--spectrum learning within a plugin-based architecture. Its modular design enables users to compare, combine, and extend workflow and analysis components without modifying the core codebase, providing a flexible and reusable alternative to single-purpose implementations. XANESNET supports both forward prediction from atomic structures to spectra and inverse inference from spectra to structures, properties, or descriptors. Through PyTorch Lightning, we enable multi-device training using Distributed Data Parallel (DDP) across multiple GPUs. A shared data pipeline uniformly handles both molecular and periodic systems. Although the framework is agnostic to spectroscopic techniques, current modules primarily implement atom-centred spectra. We demonstrate its use for learning structure--spectrum relationships in X-ray absorption spectroscopy. To our knowledge, \textsc{XANESNET} is the first general-purpose machine-learning framework for spectroscopy with a central focus on extensibility and reproducibility. This facilitates systematic comparisons and evaluations of machine-learning approaches, lowering the barrier for researchers to develop and benchmark novel methods.
20
16
21
17
## Highlights
22
18
@@ -37,15 +33,17 @@ We present XANESNET, a PyTorch-based, open-source software framework for machine
37
33
38
34
Install from a local checkout with the project metadata in [pyproject.toml](pyproject.toml):
39
35
40
-
From the XANESNET directory:
36
+
From the XANESNET directory, create an environment and install a matching CPU PyTorch/PyG wheel set before XANESNET. This Python 3.12 sequence was tested with PyTorch 2.5.1:
For a non-editable install, use`python -m pip install .` instead of `-e .`, after installing the matching PyTorch/PyG wheels.
49
47
50
48
```bash
51
49
python -m pip install .
@@ -59,19 +57,21 @@ xanesnet --help
59
57
60
58
### PyTorch and PyTorch Geometric
61
59
62
-
XANESNET depends on PyTorch and PyTorch Geometric native extensions. CPU-only Linux installs may work with plain pip resolution. For CUDA installs, or if `torch-scatter`, `torch-sparse`, or `torch-cluster` cannot find wheels automatically, install wheels matching your Python, PyTorch, and CUDA versions first.
60
+
XANESNET depends on PyTorch and PyTorch Geometric native extensions. The PyTorch version and CPU/CUDA build must match the extension wheels. If no matching wheel is installed first, pip may try to compile an extension from source and fail.
63
61
64
-
Example for PyTorch 2.5 with CUDA 12.4:
62
+
For CUDA 12.4 with PyTorch 2.5.1, install the matching wheels before XANESNET:
Adjust the wheel URLs for your target platform. The PyTorch and PyTorch Geometric installation guides are the source of truth for the current compatibility matrix.
70
+
For other Python, PyTorch, or CUDA versions, choose the corresponding wheel URLs from the PyTorch and PyTorch Geometric installation guides. Keep the PyTorch and extension versions aligned.
73
71
74
72
### Lightning, Developer and Docs Extras
73
+
After installing the matching PyTorch/PyG wheels and the base package, install optional tooling as needed:
74
+
75
75
76
76
```bash
77
77
python -m pip install -e ".[lightning]"# Lightning training backend
@@ -83,7 +83,7 @@ python -m pip install -e ".[docs,lightning]" # docs tooling and Lightning API im
83
83
84
84
## Config UI
85
85
86
-
The config UI in [tools/config-ui/](tools/config-ui/) is an interactive React editor for XANESNET `train`, `infer`, and `analyze` YAML files. It is useful both as a guided config builder and as a browsable reference for valid options in the current forward workflow.
86
+
The config UI in [tools/config-ui/](tools/config-ui/) is an interactive React editor for XANESNET `train`, `infer`, and `analyze` YAML files. It is useful both as a guided config builder and as a browsable reference for valid options in the forward and inverse workflows.
87
87
88
88
It provides:
89
89
@@ -118,7 +118,7 @@ More details are in [tools/config-ui/README.md](tools/config-ui/README.md).
118
118
119
119
## Usage
120
120
121
-
XANESNET runs are driven by YAML configuration files. The supported workflow today is forward spectrum prediction: prepare structure/spectrum data, train a model, infer spectra with a saved checkpoint, and analyze inference-run outputs. Examples live in [configs/](configs/), including [configs/mlp.yaml](configs/mlp.yaml), [configs/mlp_infer.yaml](configs/mlp_infer.yaml), and [configs/analyze_example.yaml](configs/analyze_example.yaml).
121
+
XANESNET runs are driven by YAML configuration files. The main example workflow is forward structure-to-spectrum prediction: prepare structure/spectrum data, train a model, infer spectra with a saved checkpoint, and analyze inference-run outputs. The framework also supports inverse inference with registered descriptor and multi-head model pairings. Examples live in [configs/](configs/), including [configs/mlp.yaml](configs/mlp.yaml), [configs/mlp_infer.yaml](configs/mlp_infer.yaml), and [configs/analyze_example.yaml](configs/analyze_example.yaml).
122
122
123
123
### Train
124
124
@@ -130,7 +130,7 @@ xanesnet train \
130
130
-y
131
131
```
132
132
133
-
Training outputs are written under `runs/<timestamp>_train_<name>/`. Typical outputs include the copied raw config, validated and resolved configs, split indices, the signature (`models/signature.yaml`), final checkpoints (`models/final.pth` for inference and `models/final_full.pth` with the full training state), periodic checkpoints in `checkpoints/`, logs, and optional TensorBoard files. When TensorBoard is enabled, model weight and gradient histograms are omitted by default; pass `--log-weights` to include them.
133
+
Training outputs are written under `runs/train_<name>_NNN/` (or `runs/train_000/` without a name). Typical outputs include the copied raw config, validated and resolved configs, split indices, the signature (`models/signature.yaml`), final checkpoints (`models/final.pth` for inference and `models/final_full.pth` with the full training state), periodic checkpoints in `checkpoints/`, logs, and optional TensorBoard files. When TensorBoard is enabled, model weight and gradient histograms are omitted by default; pass `--log-weights` to include them.
134
134
135
135
Use `--dry-run` with `xanesnet train` to construct the normal training pipeline, run one real epoch, and write `model_profile.json` with the model architecture, parameter counts, model size, and peak CUDA memory for that epoch when CUDA is available.
136
136
@@ -188,7 +188,7 @@ At a high level, a config contains:
188
188
189
189
-`seed` and `device`
190
190
-`datasource`: input structure and spectrum source
191
-
-`dataset`: preprocessing, storage, split, and descriptor or graph settings; set `dataset_type` to `descriptor` (forward) or `descriptor_inverse` (inverse) for descriptor workflows
191
+
-`dataset`: preprocessing, storage, split, and descriptor or graph settings;
192
192
-`model`: model family and hyperparameters
193
193
- exactly one runner section: `trainer`, `inferencer`, or analysis settings depending on workflow
194
194
-`strategy`: single-model, deep-ensemble, bootstrap, or k-fold training and inference behavior
@@ -218,7 +218,7 @@ This project is licensed under the GPL-3.0 License. See [LICENSE](LICENSE) for d
218
218
## Publications
219
219
220
220
### Main Reference
221
-
*[XANESNET: A Modular, Extensible, and Flexible Machine Learning Framework for Spectroscopy](https://placeholdmon.vercel.app/)* - H. Junkawitsch, B. Li, T. Pope, A. Bande, and T. Penfold, 2026.
221
+
*XANESNET: A Modular, Extensible, and Flexible Machine Learning Framework for Spectroscopy* - H. Junkawitsch, B. Li, T. Pope, A. Bande, and T. Penfold, 2026.
222
222
223
223
### XANESNET
224
224
*[A Deep Neural Network for the Rapid Prediction of X-ray Absorption Spectra](https://doi.org/10.1021/acs.jpca.0c03723)* - C. D. Rankine, M. M. M. Madkhali, and T. J. Penfold, *J. Phys. Chem. A*, 2020, **124**, 4263-4270.
Copy file name to clipboardExpand all lines: docs/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,10 @@ This directory contains the [Sphinx](https://www.sphinx-doc.org/) sources for th
4
4
5
5
## Building
6
6
7
-
Install the documentation extras into the active environment (one-off):
7
+
In a fresh environment, first install a matching PyTorch/PyG wheel set as described in the [installation guide](source/user-guide/install.rst). Then install the documentation extras (Lightning is included because its trainer is part of the API reference):
Copy file name to clipboardExpand all lines: docs/source/user-guide/install.rst
+16-17Lines changed: 16 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,3 @@
1
-
..
2
-
TODO: Do we keep both GitHub and GitLab links?
3
-
TODO: We should align the README.md "Install" section with this page.
4
-
TODO: We should test a fresh install!
5
-
6
1
Installing XANESNET
7
2
===================
8
3
@@ -34,7 +29,8 @@ Requirements
34
29
35
30
* Linux (tested on Ubuntu)
36
31
* Python 3.12 and above
37
-
* A C/C++ build toolchain if pip needs to compile native PyTorch Geometric extensions.
32
+
* Matching PyTorch and PyTorch Geometric wheels for the chosen Python, PyTorch, and CPU/CUDA versions.
33
+
* A C/C++ build toolchain only if pip must compile native PyTorch Geometric extensions from source.
38
34
* Optional: NVIDIA GPU and CUDA-compatible PyTorch wheels for ``device: cuda``.
39
35
40
36
The Lightning trainer is an optional extra. Install it with ``python -m pip install -e ".[lightning]"`` when using ``trainer_type: lightning``.
@@ -45,27 +41,34 @@ CPU-only training does not require CUDA. MPS devices are currently unsupported a
45
41
Installation
46
42
------------
47
43
48
-
Install the package from the XANESNET repository root:
44
+
The following Python 3.12 CPU-only sequence was tested from the XANESNET repository root. Install PyTorch and its matching PyTorch Geometric extension wheels before the package so pip does not attempt an incompatible source build:
For a non-editable install, replace ``-e .`` with ``.`` after installing the matching PyTorch/PyG wheels:
58
56
59
57
.. code-block:: bash
60
58
61
59
python -m pip install .
62
60
63
61
To use the optional Lightning trainer, include its extra:
64
-
65
62
.. code-block:: bash
66
63
67
64
python -m pip install -e ".[lightning]"
68
65
66
+
To build the API documentation, install the documentation and Lightning extras:
67
+
68
+
.. code-block:: bash
69
+
70
+
python -m pip install -e ".[docs,lightning]"
71
+
69
72
Verify the installation:
70
73
71
74
.. code-block:: bash
@@ -79,19 +82,15 @@ For the work-in-progress browser-based config editor, see :doc:`config-editor`.
79
82
PyTorch and PyTorch Geometric
80
83
-----------------------------
81
84
82
-
XANESNET depends on PyTorch and PyTorch Geometric.
83
-
On Linux with CPU-only PyTorch, a normal ``pip install`` is often enough.
85
+
XANESNET depends on PyTorch and PyTorch Geometric native extensions. The PyTorch version and CPU/CUDA build must match the extension wheels. The CPU-only sequence above uses PyTorch 2.5.1 and its matching ``pt25cpu`` wheels.
84
86
85
-
For CUDA, or if packages such as ``torch-scatter``, ``torch-sparse``, or ``torch-cluster`` fail to install,
86
-
install matching wheels for your Python, PyTorch, and CUDA versions first, then install XANESNET.
87
+
For CUDA, install matching wheels first, then install XANESNET. Example for PyTorch 2.5.1 with CUDA 12.4:
The PyTorch and PyTorch Geometric installation guides are the source of truth for the current compatibility matrix.
96
+
For other combinations, choose wheel URLs from the PyTorch and PyTorch Geometric installation guides and keep the PyTorch and extension versions aligned.
Copy file name to clipboardExpand all lines: docs/source/user-guide/intro.rst
+2-10Lines changed: 2 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,7 @@ Introduction
4
4
XANESNET overview
5
5
-----------------
6
6
7
-
We present XANESNET, a PyTorch-based, open-source software framework for machine learning in spectroscopy.
8
-
The framework integrates training, inference, and automated analysis within a plugin-based architecture.
9
-
Its modular design enables users to compare, combine, and extend different machine-learning workflow and analysis components
10
-
without modifying the core codebase, providing a flexible and reusable framework rather than a single-purpose implementation.
11
-
XANESNET supports both forward prediction from structure to spectrum and inverse inference from spectra to structures or properties.
12
-
A common data pipeline uniformly handles both molecular and periodic systems. Moreover, the framework remains entirely agnostic to the spectroscopic technique.
13
-
We demonstrate its use for learning structure-spectrum relationships in X-ray absorption spectroscopy.
14
-
By prioritizing extensibility and reproducibility, XANESNET facilitates systematic comparison and evaluation of machine-learning approaches,
15
-
lowering the barrier to research and accelerating the development and reuse of methods in spectroscopy.
7
+
We present XANESNET, an open-source, PyTorch-based software package for machine learning in spectroscopy. Specifically, the framework integrates training, inference, and automated analysis for structure--spectrum learning within a plugin-based architecture. Its modular design enables users to compare, combine, and extend workflow and analysis components without modifying the core codebase, providing a flexible and reusable alternative to single-purpose implementations. XANESNET supports both forward prediction from atomic structures to spectra and inverse inference from spectra to structures, properties, or descriptors. Through PyTorch Lightning, we enable multi-device training using Distributed Data Parallel (DDP) across multiple GPUs. A shared data pipeline uniformly handles both molecular and periodic systems. Although the framework is agnostic to spectroscopic techniques, current modules primarily implement atom-centred spectra. We demonstrate its use for learning structure--spectrum relationships in X-ray absorption spectroscopy. To our knowledge, \textsc{XANESNET} is the first general-purpose machine-learning framework for spectroscopy with a central focus on extensibility and reproducibility. This facilitates systematic comparisons and evaluations of machine-learning approaches, lowering the barrier for researchers to develop and benchmark novel methods.
16
8
17
9
XANESNET software paper
18
10
-----------------------
@@ -31,7 +23,7 @@ XANESNET features
31
23
* Modular components that can be added or replaced without changing the core workflow.
32
24
* Support for molecular and periodic structures, with feature-vector and graph representations.
33
25
* Neural-network models ranging from feed-forward to geometry-aware graph models.
34
-
* Forward and inverse workflows for spectra, structures, and properties.
26
+
* Forward prediction and inverse inference.
35
27
* Single-model and ensemble training for comparison and uncertainty estimates.
36
28
* Automated analysis with metrics, comparisons, reports, and figures.
0 commit comments