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

Refactor node attributes #64

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

JPXKQX
Copy link
Member

@JPXKQX JPXKQX commented Oct 18, 2024

This PR introduces the NamedNodesAttributes(nn.Module) class, designed to enhance the management of node attributes within graph neural networks. Key features include:

  • Node attribute tensor: The class provides a tensor that combines coordinates with trainable parameters for each set of nodes in the graph.
  • Grid size: It retains the grid_size attribute, indicating the total number of nodes.
  • Channel dimension: It tracks in_channels_src/dst, which represents the dimensionality of the node attribute tensor.

The main improvement is the ability to handle an arbitrary number of nodes. This development will facilitate extending AnemoiModelEncProcDec to other use cases, such as hierarchical models or multi-encoder/decoder.

  • Tested on 1, 2 & 4 GPUs (with model sharding & transformer)
  • Tested on 1 GPU: gnn, graphtransformer & transformer
  • Tested on 1 GPU: lam & stretched

@codecov-commenter
Copy link

codecov-commenter commented Oct 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.85%. Comparing base (deba13a) to head (f2a1eed).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop      #64   +/-   ##
========================================
  Coverage    99.84%   99.85%           
========================================
  Files           23       23           
  Lines         1301     1350   +49     
========================================
+ Hits          1299     1348   +49     
  Misses           2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JPXKQX JPXKQX self-assigned this Oct 21, 2024
@JPXKQX JPXKQX marked this pull request as ready for review October 22, 2024 10:54
@JPXKQX JPXKQX added the enhancement New feature or request label Oct 24, 2024
HCookie
HCookie previously approved these changes Oct 25, 2024
Copy link
Member

@HCookie HCookie left a comment

Choose a reason for hiding this comment

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

LGTM
Maybe consider adding some property typehinting

src/anemoi/models/layers/graph.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants