Skip to content

Commit fea74ef

Browse files
DavideTisiceriottmsofiia-chorna
authored
PET Finetuning recipe (#134)
An example of both standard and conservative fine-tuning for PET models --------- Co-authored-by: Michele Ceriotti <michele.ceriotti@gmail.com> Co-authored-by: Sofiia Chorna <chernaya.sofiia@gmail.com> Co-authored-by: Sofiia Chorna <71195115+sofiia-chorna@users.noreply.github.com>
1 parent 5b3b610 commit fea74ef

23 files changed

+2113
-3
lines changed

INSTALLING.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ you should run
6262
pip install ipykernel # in case is not part of the environment
6363
6464
# Create the kernel definition
65-
python -m ipykernel install --user --name recipei-env-path --display-name "Python (recipe)"
65+
python -m ipykernel install --user --name recipe-env-path --display-name "Python (recipe)"
6666
6767
# You can launch Jupyter from outside the conda environment,
6868
# unless you also need conda-installed executables. When you open

docs/src/software/metatensor.sec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ training and evaluating ML models.
1414
- examples/learn-tensors-with-mcov/learn-tensors-with-mcov
1515
- examples/pet-mad/pet-mad
1616
- examples/pet-mad-nc/pet-mad-nc
17+
- examples/pet-finetuning/pet-ft
18+
- examples/pet-finetuning/pet-ft-nc
1719
- examples/flashmd/flashmd-demo
1820
- examples/shiftml/shiftml-example
1921
- examples/hamiltonian-qm7/hamiltonian-qm7

docs/src/topics/ml-models.sec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ data.
1313
- examples/learn-tensors-with-mcov/learn-tensors-with-mcov
1414
- examples/pet-mad/pet-mad
1515
- examples/pet-mad-nc/pet-mad-nc
16+
- examples/pet-finetuning/pet-ft
17+
- examples/pet-finetuning/pet-ft-nc
1618
- examples/flashmd/flashmd-demo
1719
- examples/shiftml/shiftml-example
1820
- examples/hamiltonian-qm7/hamiltonian-qm7

examples/pet-finetuning/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.data
2+
*.pt
3+
*.ckpt
4+
log.lammps
5+
trajectory.xyz
6+
tmp*
7+
8+
extensions/*
9+
10+
outputs/
11+
data/ethanol_train.xyz
12+
data/ethanol_val.xyz
13+
data/ethanol_test.xyz
14+
data/ethanol_corrected.xyz
15+
output.xyz

examples/pet-finetuning/README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
PET-MAD finetuning tutorial
2+
===========================
3+
4+
An example of finetuning the PET-MAD universal machine-learning potential.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
seed: 42
2+
3+
architecture:
4+
name: pet
5+
training:
6+
num_epochs: 20
7+
num_epochs_warmup: 1
8+
learning_rate: 1e-4
9+
10+
training_set:
11+
systems:
12+
read_from: data/ethanol_train.xyz
13+
length_unit: angstrom
14+
targets:
15+
energy:
16+
key: energy
17+
unit: eV
18+
forces: on
19+
non_conservative_forces:
20+
key: forces
21+
quantity: force
22+
unit: eV/A
23+
type:
24+
cartesian:
25+
rank: 1
26+
per_atom: true
27+
28+
validation_set:
29+
systems:
30+
read_from: data/ethanol_val.xyz
31+
length_unit: angstrom
32+
targets:
33+
energy:
34+
key: energy
35+
unit: eV
36+
forces: on
37+
non_conservative_forces:
38+
key: forces
39+
quantity: force
40+
unit: eV/A
41+
type:
42+
cartesian:
43+
rank: 1
44+
per_atom: true
45+
46+
test_set:
47+
systems:
48+
read_from: data/ethanol_test.xyz
49+
length_unit: angstrom
50+
targets:
51+
energy:
52+
key: energy
53+
unit: eV
54+
forces: on
55+
non_conservative_forces:
56+
key: forces
57+
quantity: force
58+
unit: eV/A
59+
type:
60+
cartesian:
61+
rank: 1
62+
per_atom: true
267 KB
Loading

examples/pet-finetuning/data/ethanol.xyz

Lines changed: 1100 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
channels:
2+
- metatensor
3+
- conda-forge
4+
dependencies:
5+
- python=3.12
6+
- pip
7+
- pip:
8+
- ase>=3.23
9+
- metatrain[pet]>=2025.8,<2026
10+
- matplotlib
11+
- scikit-learn
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
seed: 42
2+
3+
architecture:
4+
name: pet
5+
6+
training:
7+
batch_size: 16
8+
num_epochs: 50
9+
num_epochs_warmup: 10
10+
learning_rate: 1e-4
11+
12+
13+
# this needs specifying based on the specific dataset
14+
training_set:
15+
systems:
16+
read_from: "data/ethanol_train.xyz" # path to the finetuning dataset
17+
length_unit: angstrom
18+
targets:
19+
energy:
20+
key: "energy-corrected" # name of the target value
21+
unit: "eV"
22+
23+
validation_set:
24+
systems:
25+
read_from: "data/ethanol_val.xyz"
26+
length_unit: angstrom
27+
targets:
28+
energy:
29+
key: "energy-corrected"
30+
unit: "eV"
31+
32+
test_set:
33+
systems:
34+
read_from: "data/ethanol_test.xyz"
35+
length_unit: angstrom
36+
targets:
37+
energy:
38+
key: "energy-corrected"
39+
unit: "eV"

0 commit comments

Comments
 (0)