Introduce graph classes for graph-based models #65
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.
Describe your changes
The actual graph constructions (mesh graphs + m2g and g2m edges) currently take the form as a set of tensors in the code.
All these tensors are passed around and used in the different model classes in a somewhat unstructured way. See for example:
neural-lam/neural_lam/models/base_hi_graph_model.py
Lines 43 to 45 in 066efe0
This also means that there are some more or less hacky ways that we differentiate between hierarchical and "flat" graphs (see
utils.load_graph
):neural-lam/neural_lam/utils.py
Line 111 in 066efe0
The idea of this change is to keep the full representation of a graph together in one object. This means that all tensors (edge_index and features) related to the graph sits together in a coherent structure.
At the moment this loads the graph tensors from the same kind of saved
.pt
files as in the current implementation. There has been some discussion about just directly serializing these graph objects, and then using them also in https://github.com/mllam/weather-model-graphs.Some TODOs:
nn.Module
. Test that moving to GPU still works.Issue Link
Does not directly solve an issue, but should be used in #4.
Type of change
Checklist before requesting a review
pull
with--rebase
option if possible).Checklist for reviewers
Each PR comes with its own improvements and flaws. The reviewer should check the following:
Author checklist after completed review
reflecting type of change, for example "bug fixes", add section where
missing)
Checklist for assignee