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

restructure embeddings to avoid issues with torch jit #634

Merged
merged 5 commits into from
Jul 9, 2024

Conversation

stefaanhessmann
Copy link
Collaborator

I restructured the embeddings to avoid problems with torch jit.

Nuclear and electronic embeddings are separated, because electronic embeddings currently require (embedding, inputs) as arguments in the forward pass and nuclear embeddings only require atomic_numbers in the forward pass.
With this, we can further use torch.nn.Embedding as a default value and electronic embeddings can be added as nn.ModuleList.

This is still a draft and not tested!

src/schnetpack/nn/embedding.py Outdated Show resolved Hide resolved
src/schnetpack/nn/embedding.py Outdated Show resolved Hide resolved
src/schnetpack/representation/painn.py Outdated Show resolved Hide resolved
src/schnetpack/representation/schnet.py Outdated Show resolved Hide resolved
src/schnetpack/representation/so3net.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@jnsLs jnsLs left a comment

Choose a reason for hiding this comment

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

I like the structure very much :)
After the minor changes have been implemented I would approve the PR

src/schnetpack/nn/embedding.py Outdated Show resolved Hide resolved
src/schnetpack/representation/schnet.py Outdated Show resolved Hide resolved
src/schnetpack/representation/schnet.py Outdated Show resolved Hide resolved
@stefaanhessmann stefaanhessmann marked this pull request as ready for review July 9, 2024 09:58
@jnsLs jnsLs merged commit 4cff703 into master Jul 9, 2024
@jnsLs jnsLs mentioned this pull request Jul 9, 2024
@stefaanhessmann stefaanhessmann deleted the sh/fix_embeddings branch July 9, 2024 12:00
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.

2 participants