Migrating to PiNN 2.x

Since version 2.x, a modularized design, PiNet2, has been implemented for equivariant atomistic potential training. PiNet2 is compatible with PiNet1, and you can use the rank parameter to specify the desired feature order. To use PiNet, you can either call pinet or use pinet2(rank=3)—both are functionally equivalent. However, trained models are not interchangeable between the two, meaning you will need to retrain your model if switching versions.

A workflow using Nextflow is also integrated, enabling model training on clusters via SLURM or other resource management systems. Examples can be found in the nextflow.config file and the notebook.

Upgrading the TensorFlow backend to 2.15

PiNN's supported TensorFlow window has moved up to TensorFlow 2.15 (Python 3.9–3.11, numpy<2). This is the last release that still ships tf.estimator and the legacy Keras optimizers — both removed in TF 2.16 — while also supporting recent GPUs (NVIDIA Hopper / sm_90, e.g. GH200). PiNN's training loop is built on tf.estimator, so 2.15 is the ceiling until the estimator path is rewritten.

Installing

pip install -e '.[cpu]'   # tensorflow-cpu >=2.15,<2.16; ASE >=3.25 from setup.py
pip install -e '.[gpu]'   # tensorflow     >=2.15,<2.16  (x86_64 CUDA wheel)
# or: conda env create -f environment.yml && pip install -e .

aarch64 GPUs (e.g. GH200)

There is no GPU TensorFlow wheel for aarch64 on PyPI or conda-forge (both are CPU-only). The only aarch64 GPU build of TF 2.15 is the NVIDIA NGC container nvcr.io/nvidia/tensorflow:24.03-tf2-py3; Dockerfile.gpu / Singularity.gpu are based on it. On x86_64 the normal tensorflow CUDA wheel works.

What changed under the hood

Most changes are internal; existing parameter files and trained 2.x models keep working. The notable points:

Behavioural note: RNG determinism

tf.random.set_seed(...) no longer makes two independently-constructed Keras models share weights the way it did on older TF. If you relied on that for reproducibility, set the seed and then copy weights explicitly (model_b.set_weights(model_a.get_weights())), or seed the layer initializers directly.

Migrating to PiNN 1.x (TF2)

Since version 1.x, PiNN switched to TensorFlow 2 as a backend, this introduces changes to the API. This document provides information for the changes and guides for migration.

New features

CLI: PiNN 1.x introduces a new entry point pinn as the command line interface. The trainer module will be replaced with the pinn train sub-command. The CLI also exposes utilities like dataset conversion for easier usage.

Parameter file: in PiNN 1.0 the parameter file will serve as a comprehensive input for PiNN models, the structure of the parameter file is changed, see the documentation for more information.

Extended Kalman filter: an experimental extended Kalman filter (EKF) optimizer is implemented.

Notes for developers

Datasets: dataset loaders should be most compatible with PiNN 0.x. With the TF2 update, dataset may be inspected interactively with eager execution. Splitting option is simplified (see below), and splitting of load_tfrecord becomes possible.

Networks: following the guideline of TF2, networks in PiNN 1.x are new Keras models and layers becomes Keras layers. This means the PiNN networks can be used to perform some simple prediction tasks. Note that PiNN models are still implemented as TensorFlow estimators since they provide a better control over the training and prediction behavior. Like the design of PiNN 0.x, the models interpret the predictions of PiNN networks as physical quantities and interface them to atomic simulation packages.

Models: new helper function export_model and class MetricsCollector are implemented to simplify the implementation of models, see the source of dipole model for an example.

Breaking changes

« Previous
Next »