Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From the creators of
experimental.mace...This one is quite experimental and I'm not sure it will ever aim at being stable, let's see.
What it is useful for
This architecture predicts sparse matrices in spherical basis from the output of any model.
Implementation
The idea of the architecture is simple enough: it takes any architecture in metatrain, asks for a spherical per-atom output, and then applies graph2mat on top of it. This is basically what I had in mind when I developed
graph2mat, so I'm very happy thatmetatrainstandardizes everything in a way that implementing this is "trivial" (you know, once you have spent a whole year in COSMO 😆).The architecture supports multiple matrix targets, and for each target a separate graph is built, since different matrices can have different sparsity patterns. As a consequence of this, the graph used to construct each matrix is not shared by the base (featurizer) model. E.g. the base model can have a higher/lower/adaptive cutoff for neighbors, or even not have a graph at all.
The main point of friction with
metatrainis thatgraph2matworks with a completely flattened array as the batch (due to the sparsity/raggedness of the target), whilemetatrainin general is more suited for uniform targets (e.g. the supportedTargetInfos). For now I solved the problem by using aDiskDatasetthat makesmetatrainhappy, but then converting tograph2matbatch in a callable of the collate function.I tested this with
soap_bpnn,PETandMACEand it is working fine.Future perspective
There is a case for thinking that the architecture is unnecessary, since one can just add
graph2matas a head in the architectures where it makes sense. However, I think it is good to first test things in this experimental architecture because things are probably going to change fast.There are also architectures for which other approaches are probably much more efficient and using graph2mat for matrices would make things unnecessarily complex. For example, @jwa7 is working on a more native way of doing this in PET.
Still, since
graph2matis very modular and easy to modify, it is nice to have it to quickly test new approaches before moving into modifying the other architectures (non-goal of metatrain, I know haha).Things missing.
For a proof of concept, I made up a target type (
basis) that allows me to play with things. This will be changed to adapt to the target type that Joe is using in his PET implementation, since after all forgraph2matthe target type is just a tool to trickmetatraininto allowing its running. Therefore, this PR is likely to stay as a draft until Joe finishes his implementation.Generating inputs
The architecture requires mainly two non-trivial inputs: the disk dataset and the basis specification. Both will be creatable using
graph2mattools, although the disk dataset will be general enough that it could be generated with whatever other tool.To test it
[not tested on GPU, will test soon!]
The architecture can be tested with this subset of 100 QM9 structures: https://drive.google.com/file/d/1gV4QP4ZwW_BDXdSe0K-UPvu2G3NPg2Nt/view?usp=sharing, which contains the
density_matrix,hamiltonian,energy_density_matrixandoverlap.Then run
mtt trainwith the typical options yaml:With the
qm9_basis.yamlfile containing the basis specification:Hope you think this is nice, and looking forward to having this one merged :)
Contributor (creator of pull-request) checklist
experimentalorstablefolder. See the[docs/src/dev-docs/architecture-life-cycle.rst](Architecture life cycle)
document for requirements.
src/metatrain/experimental/<architecture_name>.github/workflow/architecture-tests.yml)optional-dependenciessection in thepyproject.tomlReviewer checklist
New experimental architectures
tests.
TorchScript <https://pytorch.org/docs/stable/jit.html>_.__maintainers__and theCODEOWNERSfilePyPI, a public git repository or another public URL with a repository is acceptable.
New stable architectures
file.
PyPI.
metatrain, includinglogging and model save locations.
📚 Documentation preview 📚: https://metatrain--979.org.readthedocs.build/en/979/