Skip to content

Conversation

@frostedoyster
Copy link
Collaborator

@frostedoyster frostedoyster commented Oct 31, 2025

Addresses #571

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--876.org.readthedocs.build/en/876/

@frostedoyster
Copy link
Collaborator Author

@copilot I've added the base class for the model. Now we would need the same, but for the trainer. The only thing that the trainer needs to know from the derived class is whether to do data augmentation or not. To write the base trainer, you can take inspiration from those of SOAP-BPNN (no rotational augmentation) and PET (does rotational augmentation)

Copy link
Contributor

Copilot AI commented Oct 31, 2025

@frostedoyster I've opened a new pull request, #877, to work on those changes. Once the pull request is ready, I'll request review from you.

@frostedoyster
Copy link
Collaborator Author

@copilot Would you be able to

  • fix the tests, linter and so on
  • add a new architecture under src/metatrain/example which always predicts zero as the energy using the new base classes
  • add a new section on "adding a new architecture" based on this minimalistic example
  • tests that the new example works
    ?

Copy link
Contributor

Copilot AI commented Oct 31, 2025

@frostedoyster I've opened a new pull request, #880, to work on those changes. Once the pull request is ready, I'll request review from you.

@frostedoyster
Copy link
Collaborator Author

@copilot can you fix the tests and docs?

Copy link
Contributor

Copilot AI commented Oct 31, 2025

@frostedoyster I've opened a new pull request, #884, to work on those changes. Once the pull request is ready, I'll request review from you.

@frostedoyster
Copy link
Collaborator Author

@copilot Could you address the review comments, please?

Copy link
Contributor

Copilot AI commented Oct 31, 2025

@frostedoyster I've opened a new pull request, #885, to work on those changes. Once the pull request is ready, I'll request review from you.

@frostedoyster
Copy link
Collaborator Author

@copilot Can you implement the review comment?

Copy link
Contributor

Copilot AI commented Nov 1, 2025

@frostedoyster I've opened a new pull request, #887, to work on those changes. Once the pull request is ready, I'll request review from you.

Example: Creating an MLIP-only architecture
--------------------------------------------

To demonstrate how easy it is to add a new MLIP-only architecture using the base
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
To demonstrate how easy it is to add a new MLIP-only architecture using the base
To demonstrate how to add a new MLIP-only architecture using the base

Comment on lines +10 to +16
__authors__ = [
("GitHub Copilot <[email protected]>", "@copilot"),
]

__maintainers__ = [
("GitHub Copilot <[email protected]>", "@copilot"),
]
Copy link
Member

Choose a reason for hiding this comment

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

@frostedoyster that should be you

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we want example code like this to live inside src/metatrain. It is not something we want to distribute to everyone

Comment on lines +333 to +337
edge_vectors: torch.Tensor,
species: torch.Tensor,
centers: torch.Tensor,
neighbors: torch.Tensor,
system_indices: torch.Tensor,
Copy link
Member

Choose a reason for hiding this comment

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

I don't love that the API here is so different from the metatomic interface. Ideally this class should help people move toward a deeper integration if they need it down the line.

Maybe something like edge_vector => pair_vectors/pair_distances, centers, neighbors => pair_indices (not sure about this one), species => atomic_types.

Also, should the model have access to the raw positions/cell? Or is this limited to GNN style models?

Suggested change
edge_vectors: torch.Tensor,
species: torch.Tensor,
centers: torch.Tensor,
neighbors: torch.Tensor,
system_indices: torch.Tensor,
system_indices: torch.Tensor,
atomic_types: torch.Tensor,
centers: torch.Tensor,
neighbors: torch.Tensor,
pair_vectors: torch.Tensor,

or

Suggested change
edge_vectors: torch.Tensor,
species: torch.Tensor,
centers: torch.Tensor,
neighbors: torch.Tensor,
system_indices: torch.Tensor,
system_indices: torch.Tensor,
atomic_types: torch.Tensor,
pair_indices: torch.Tensor,
pair_vectors: torch.Tensor,

return AtomisticModel(self.eval(), metadata, capabilities)

@classmethod
def upgrade_checkpoint(cls, checkpoint: Dict[str, Any]) -> Dict[str, Any]:
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be possible to override from the child class, since MLIPModel has no idea about what the checkpoint will look like.

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