Skip to content

Conversation

@MarkusFas
Copy link
Contributor

@MarkusFas MarkusFas commented Nov 24, 2025

-beginner example finetuning
-added variants to concepts

Contributor (creator of pull-request) checklist

  • Tests updated (for new features and bugfixes)?
  • Documentation updated (for new features)?
  • Issue referenced (for PRs that solve an issue)?

Maintainer/Reviewer checklist

  • CHANGELOG updated with public API or any other important changes?
  • GPU tests passed (maintainer comment: "cscs-ci run")?

📚 Documentation preview 📚: https://metatrain--943.org.readthedocs.build/en/943/

Copy link
Contributor

@PicoCentauri PicoCentauri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is already much better as before. I gave it a quick read. I will do a more in depth review on the text when the docs are building.

learning_rate: 1e-5
Please note, that in most use cases you should invoke a new energy head by specifying
a new energy variant. The variant naming follows the simple pattern
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we link the variants page on metatomic?

https://docs.metatensor.org/metatomic/latest/outputs/variants.html

.. _label_fine_tuning_concept:

Fine-tune a pre-trained model
=============================
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here also goes the flow chart, right? 🤓

and maybe we add also a table of content after the flow chart?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought flowchart is rendered a bit useless, since we mostly recommend full finetuning with new head and usually inheriting weights?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay fine for me. But a TOC should be useful.

.. warning::
This section of the documentation is only relevant for PET model so far.
Finetuning is currently only available for the PET architecture.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as in the concept.

@@ -1,4 +1,7 @@
"""
.. _parity-plot-example:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need this as sphinx gallery automagically creates labels. They are a bit cumbersome but you can find them in the generated rst. For this example the label is

sphx_glr_generated_examples_0-beginner_04-parity_plot.py

Copy link
Contributor

@PicoCentauri PicoCentauri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is vert useful @MarkusFas. I left some minor comments for better styling. After the round we could merge from my side.

.. hint::

If you want to fine-tune an existing model
check out :ref:`label_fine_tuning_concept`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. But should we better kink directly to a tutorial?

Comment on lines +25 to +27
.. code-block:: bash
The basic fine-tuning strategy is a good choice in the case when the level of theory
which is used for the original training is the same, or at least similar to the one used
for the new dataset. However, since this is not always the case, we also provide more
advanced fine-tuning strategies described below.
wget https://huggingface.co/lab-cosmo/pet-mad/resolve/v1.1.0/models/pet-mad-v1.1.0.ckpt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you don't need this here. Below you do the same. You can maybe below the python code paste the bash command.

different from the reference of the pretrained model, it is recommended to create a
new energy head. Using this so-called energy variant can be simply invoked by
requesting a new target in the options file. Follow the nomenclature
energy/{yourname}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
energy/{yourname}.
``energy/{yourname}``.

options in the ``options.yaml`` file. The following options need to be set:
A simple ``options-ft.yaml`` file for this task could look like this:
.. code-block:: yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could directly import the yaml file that you wrote using literalinclude. This avoids duplication.

Comment on lines +148 to +154
subprocess.run(
[
"wget",
"https://huggingface.co/lab-cosmo/pet-mad/resolve/v1.1.0/models/pet-mad-v1.1.0.ckpt",
]
)
subprocess.run(["rm", "-rf", "outputs"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of them should have check=true.

Comment on lines +157 to +158
# %%
#
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add some text what the next step after the training is.
Basically saying the we plot the training curve now.

validation_energy_RMSE = structured["validation energy/finetune RMSE (per atom)"]
validation_forces_MAE = structured["validation forces[energy/finetune] MAE"]

fig, axs = plt.subplots(1, 2, figsize=(12, 5))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The labels of the figure are a bit small with figsize=(12, 5). Maybe you stack the plot vertically?

Comment on lines +265 to +266
# %%
#
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe give some text here between the blocks or make it one big code block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants