Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow appending extra values to embedding vector #289

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

peastman
Copy link
Collaborator

This feature lets you inject extra per-sample or per-atom values into the model. They are appended to the embedding vector for each atom, then a linear layer mixes them in and reduces the vector back down to its original size. In the config file, you specify one or more extra fields from the dataset that should be added to the embedding:

extra_embedding: partial_charges

or

extra_embedding:
  - partial_charges
  - total_charge

Each one can have a single value per sample (for a global scalar like total charge) or a value for each atom.

When calling the model for inference, you specify them with extra_args:

model(z, pos, extra_args={'partial_charges':partial_charges)

See #26 (comment) for discussion.

@RaulPPelaez
Copy link
Collaborator

The design and implementation are great and retrocompatible.
@guillemsimeon, could you comment on the architecture changes?
Peter made it so that the extra arguments are mixed with the embedding using a Linear layer:

if extra_embedding is not None:
self.reshape_embedding = nn.Linear(hidden_channels+len(extra_embedding), hidden_channels, dtype=dtype)
else:
self.reshape_embedding = None

if self.reshape_embedding is not None:
Z = torch.cat((Z,)+tuple(t.unsqueeze(1) for t in extra_embedding_args), dim=1)
Z = self.reshape_embedding(Z)

@guillemsimeon
Copy link
Collaborator

guillemsimeon commented Feb 22, 2024 via email

This was referenced Feb 23, 2024
@peastman
Copy link
Collaborator Author

This is finished and ready to merge as far as I'm concerned. I'm getting good results with it. Can someone review it?

@giadefa
Copy link
Contributor

giadefa commented Feb 27, 2024 via email

@peastman
Copy link
Collaborator Author

Why can't we merge it? What are you doing that conflicts with it?

If this isn't going to be run as an open source project, I can't use it. I need a stable, reliable base to build my research on. That means development is done in public, and I can add features that are essential to my research. If you're going to reject changes without explanation because they conflict with things you're doing in secret and can't tell me about, then I need to end my involvement in this project.

@giadefa
Copy link
Contributor

giadefa commented Feb 27, 2024 via email

@peastman
Copy link
Collaborator Author

As I said before, it is not a change to the existing model. It's a completely new feature. If you don't use the new feature, nothing in your model changes the slightest bit. It breaks nothing. It conflicts with nothing.

I've already done extensive testing of it and found that it substantially improves accuracy. I can post numbers if you want to see them. What additional validation do you need?

And we really need to do development in public. Being told you are working on "something" that "might" supersede this in the future, but it's secret and you can't tell me about it, is very frustrating and not useful. In an open source project, decisions get made in public based on public information. You can have your own internal branch where you work on things you don't want to share. But you can't block development of the public version for private reasons that you won't tell anyone.

If I'm going to base my research on this project, it needs to be a stable base to build on. That means having a clear process for reviewing and merging PRs. I have a whole series of features I want to add. I can't create a branch with a new feature, then another branch with another feature based on top of that one, then a third branch with a third feature based on the second one, and so on for months, with my version of the code steadily diverging from the main repo and never knowing whether the very first PR will get rejected and break everything I did after.

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.

4 participants