Skip to content

Commit dc6e894

Browse files
release: create release-0.0.1a5 branch
1 parent 6051e4c commit dc6e894

18 files changed

+116
-63
lines changed

.github/workflows/tests_and_linters.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Open-source Tests and Linters 🧪
1+
name: Tests and Linters 🧪
22

33
on:
44
push:

CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changelog
22

3-
## Release 1.0.0
3+
## Release 0.1.0
44

55
To be added upon release...

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM python:3.10.12-slim-bullseye
2+
3+
WORKDIR /app
4+
5+
RUN apt-get update && apt-get install -y git wget
6+
7+
RUN pip install mlip "jax[cuda12]==0.4.33" huggingface_hub git+https://github.com/jax-md/jax-md.git notebook
8+
9+
RUN wget https://raw.githubusercontent.com/instadeepai/mlip/refs/heads/main/tutorials/simulation_tutorial.ipynb \
10+
https://raw.githubusercontent.com/instadeepai/mlip/refs/heads/main/tutorials/model_training_tutorial.ipynb \
11+
https://raw.githubusercontent.com/instadeepai/mlip/refs/heads/main/tutorials/model_addition_tutorial.ipynb
12+
13+
EXPOSE 8888
14+
15+
CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]

Dockerfile.release

Lines changed: 0 additions & 15 deletions
This file was deleted.

README.md

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,22 @@ pip install notebook && jupyter notebook
9696
The installation of *mlip* itself is included within the notebooks. We recommend to
9797
run these notebooks with GPU acceleration enabled.
9898

99-
## 🤗 Foundation models (via HuggingFace)
99+
Alternatively, we provide a `Dockerfile` in this repository that you can use to
100+
run the tutorial notebooks. This can be achieved by executing the following lines
101+
from any directory that contains the downloaded `Dockerfile`:
100102

101-
We have prepared foundation models pre-trained on a subset of the
103+
```bash
104+
docker build . -t mlip_tutorials
105+
docker run -p 8888:8888 --gpus all mlip_tutorials
106+
```
107+
108+
Note that this will only work on machines with NVIDIA GPUs.
109+
Once running, you can access the Jupyter notebook server by clicking on the URL
110+
displayed in the console of the form "http[]()://127.0.0.1:8888/tree?token=abcdef...".
111+
112+
## 🤗 Pre-trained models (via HuggingFace)
113+
114+
We have prepared pre-trained models trained on a subset of the
102115
[SPICE2 dataset](https://zenodo.org/records/10975225) for each of the models included in
103116
this repo. They can be accessed directly on [InstaDeep's MLIP collection](https://huggingface.co/collections/InstaDeepAI/ml-interatomic-potentials-68134208c01a954ede6dae42),
104117
along with our curated dataset or directly through
@@ -112,13 +125,40 @@ hf_hub_download(repo_id="InstaDeepAI/visnet-organics", filename="visnet_organics
112125
hf_hub_download(repo_id="InstaDeepAI/nequip-organics", filename="nequip_organics_01.zip", local_dir="")
113126
hf_hub_download(repo_id="InstaDeepAI/SPICE2-curated", filename="SPICE2_curated.zip", local_dir="")
114127
```
115-
Note that the foundation models are released on a different license than this library,
128+
Note that the pre-trained models are released on a different license than this library,
116129
please refer to the model cards of the relevant HuggingFace repos.
117130

131+
## 🚀 Inference time benchmarks
132+
133+
In order to showcase the runtime efficiency, we conducted benchmarks across all three models
134+
on two different systems: 1UAO (138 atoms) and 1ABT (1205 atoms), both run for 1ns on a H100
135+
NVidia GPU. All model implementations are our own, including the Torch + ASE benchmarks, and
136+
should not be considered representative of the performance of the code developed by the
137+
original authors of the methods. Further details can be found in our whitepaper (see below).
138+
139+
**MACE (2,139,152 parameters):**
140+
| Systems | JAX + JAX MD | JAX + ASE | Torch + ASE |
141+
| --------- |-------------:|-------------:|-------------:|
142+
| 1UAO | 6.3 ms/step | 11.6 ms/step | TBC ms/step |
143+
| 1ABT | TBC ms/step | TBC ms/step | TBC ms/step |
144+
145+
**ViSNet (1,137,922 parameters):**
146+
| Systems | JAX + JAX MD | JAX + ASE | Torch + ASE |
147+
| --------- |-------------:|-------------:|-------------:|
148+
| 1UAO | 2.9 ms/step | 6.2 ms/step | 33.8 ms/step |
149+
| 1ABT | 25.4 ms/step | TBC ms/step | TBC ms/step |
150+
151+
**NequIP (1,327,792 parameters):**
152+
| Systems | JAX + JAX MD | JAX + ASE | Torch + ASE |
153+
| --------- |-------------:|-------------:|-------------:|
154+
| 1UAO | 3.8 ms/step | 8.5 ms/step | 38.7 ms/step |
155+
| 1ABT | TBC ms/step | TBC ms/step | TBC ms/step |
156+
118157
## 🙏 Acknowledgments
119158

120-
We would like to acknowledge beta testers for this library: Leon Wehrhan,
121-
Sebastien Boyer, Massimo Bortone, Tom Barrett, and Alex Laterre.
159+
We would like to acknowledge beta testers for this library: Isabel Wilkinson,
160+
Nick Venanzi, Hassan Sirelkhatim, Leon Wehrhan, Sebastien Boyer, Massimo Bortone,
161+
Tom Barrett, and Alex Laterre.
122162

123163
## 📚 Citing our work
124164

@@ -128,4 +168,4 @@ C. Brunken, O. Peltre, H. Chomet, L. Walewski, M. McAuliffe, V. Heyraud,
128168
S. Attias, M. Maarand, Y. Khanfir, E. Toledo, F. Falcioni, M. Bluntzer,
129169
S. Acosta-Gutiérrez and J. Tilly, *Machine Learning Interatomic Potentials:
130170
library for efficient training, model development and simulation of molecular systems*,
131-
uploaded to arXiv soon.
171+
available on the arXiv.

docs/source/user_guide/finetuning.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ Model fine-tuning
77

88
Currently, fine-tuning is only available for MACE models.
99

10-
A common use case is fine-tuning a pre-trained MLIP foundation model
10+
A common use case is fine-tuning a pre-trained MLIP model
1111
on additional data to improve its accuracy for specific types of chemical systems.
1212

1313
In the following, we describe how to fine-tune an MLIP model with this library. We
1414
recall that an MLIP model can be trained using multiple read-out heads. Note that
1515
currently, this is just implemented for the MACE architecture. The number of read-out
1616
heads can be set via ``num_readout_heads`` in
1717
:py:func:`MaceConfig <mlip.models.mace.config.MaceConfig>`.
18-
By default, one trains a foundation model with only one read-out head. However, it does
18+
By default, one trains a model with only one read-out head. However, it does
1919
not matter for this fine-tuning step whether a model already has *N* read-out heads,
2020
it can be fine-tuned by adding more heads and optimizing their associated weights only.
2121
Note that the final energy prediction of a model is obtained by summing the outputs
2222
of the *N* read-out heads.
2323

2424
To fine-tune a given model, set up the new model with at least one more read-out head
25-
than the foundation model you already have pre-trained.
25+
than the pre-trained model.
2626

2727
.. code-block:: python
2828
2929
from mlip.models import Mace, ForceField
3030
31-
foundation_model_params = _get_params_for_pretrained_model() # placeholder
31+
pretrained_model_params = _get_params_for_pretrained_model() # placeholder
3232
3333
# Make sure the new model you create has at least one more read-out head
3434
mace = Mace(Mace.Config(num_readout_heads=2), dataset_info)
@@ -43,7 +43,7 @@ the function
4343
from mlip.models.params_transfer import transfer_params
4444
4545
transferred_params, finetuning_blocks = transfer_params(
46-
foundation_model_params,
46+
pretrained_model_params,
4747
initial_force_field.params,
4848
scale_factor=0.1,
4949
)
@@ -64,7 +64,7 @@ to experiment with this hyperparameter themselves.
6464

6565
The resulting ``transferred_params`` have the shape of your new model, but the new
6666
heads are not yet optimized. The other parameters are taken from the pre-trained
67-
foundation model. The second output of the function ``finetuning_blocks`` holds a list
67+
model. The second output of the function ``finetuning_blocks`` holds a list
6868
of module names inside the parameters that correspond to the blocks of untrained
6969
parameters. This list will be needed for the subsequent step.
7070

@@ -99,15 +99,15 @@ the transferred parameters works like this:
9999
**To summarize, there are only three additional steps that are**
100100
**required for fine-tuning in contrast to a regular model training:**
101101

102-
* Loading the original foundation model parameters *and* setting up a new model that
102+
* Loading the original pre-trained model parameters *and* setting up a new model that
103103
has the same configuration but with one or more additional read-out heads.
104104
* Transfer the parameters using the function
105105
:py:func:`transfer_params() <mlip.models.params_transfer.transfer_params>`.
106106
* Mask the optimizer using the function
107107
:py:func:`mask_optimizer_for_finetuning() <mlip.training.finetuning_utils.mask_optimizer_for_finetuning>`.
108108

109109
**Additional note:** When fine-tuning on datasets that are quite different to the
110-
original dataset which the foundation model was trained on, we recommend to add a subset
110+
original dataset which the pre-trained model was trained on, we recommend to add a subset
111111
of the original dataset to the dataset the fine-tuning is performed on. The proportion
112112
to which the original dataset should extend the new data points (e.g., 50:50 or
113113
90:10 ratio) is a hyperparameter to experiment with and the optimal choice

docs/source/user_guide/models.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Create a model and force field
99
--------------------------------
1010

1111
This section discusses how to initialize an MLIP model for subsequent training.
12-
If you are just interested in loading a pretrained model for application in simulations,
12+
If you are just interested in loading a pre-trained model for application in simulations,
1313
please see the dedicated section :ref:`below <load_zip_model>`.
1414

1515
Our MLIP models exist in two abstraction levels:
@@ -109,7 +109,7 @@ Load a model from a zip archive
109109
-------------------------------
110110

111111
To load a model (e.g., MACE) from our lightweight zip format that we ship our
112-
foundation models with, you can use the function
112+
pre-trained models with, you can use the function
113113
:py:func:`load_model_from_zip <mlip.models.model_io.load_model_from_zip>`:
114114

115115
.. code-block:: python

docs/source/user_guide/training.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ can be accessed after the run like this:
5858
5959
However, the final parameters are not always the ones with the best
6060
performance on the validation set, and hence,
61-
you can also access these with ``training_loop.best_params`` or directly
62-
use `training_loop.best_model` to get the
61+
you can also access these with ``training_loop.best_model.params``.
62+
Therefore, use `training_loop.best_model` to get the
6363
:py:class:`ForceField <mlip.models.force_field.ForceField>` instance that holds
6464
the best parameters. If you want to save a
6565
trained force field not only via the checkpointing API described further below,

mlip/models/atomic_energies.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import logging
1615
from typing import Optional, Union
1716

1817
import jax.numpy as jnp
1918

2019
from mlip.data.dataset_info import DatasetInfo
2120
from mlip.data.helpers.atomic_number_table import AtomicNumberTable
2221

23-
logger = logging.getLogger("mlip")
24-
2522

2623
def get_atomic_energies(
2724
dataset_info: DatasetInfo,
@@ -69,19 +66,13 @@ def get_atomic_energies(
6966
z_table.z_to_index(z): energy
7067
for z, energy in dataset_info.atomic_energies_map.items()
7168
}
72-
logger.debug(
73-
f"Computed average atomic energies using least "
74-
f"squares, taken from dataset info: {atomic_energies_dict}"
75-
)
7669
atomic_energies = jnp.array(
7770
[atomic_energies_dict[i] for i in range(len(z_table.zs))]
7871
)
7972
elif atomic_energies_input == "zero":
80-
logger.debug("Not using atomic energies, setting them to zero.")
8173
atomic_energies = jnp.zeros(num_species)
8274
elif isinstance(atomic_energies_input, dict):
8375
atomic_energies_dict = atomic_energies_input
84-
logger.debug(f"Use Atomic Energies that are provided: {atomic_energies_dict}")
8576
atomic_energies = jnp.array(
8677
[atomic_energies_dict.get(z, 0.0) for z in range(num_species)]
8778
)

mlip/models/mace/blocks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# MIT License
2+
# Copyright (c) 2022 mace-jax
3+
# See https://github.com/ACEsuit/mace-jax/blob/main/MIT.md
4+
#
15
# Copyright 2025 InstaDeep Ltd
26
#
37
# Licensed under the Apache License, Version 2.0 (the "License");

0 commit comments

Comments
 (0)