Skip to content

Conversation

@Rilwan-Adewoyin
Copy link
Member

@Rilwan-Adewoyin Rilwan-Adewoyin commented Sep 14, 2025

closes #402

Description

Context and Discussion on PR -->: #402

What problem does this change solve?

  • Non Breaking change only affects Time Interpolator

  • Implements the mass conservation for temporal interpolation of accumulated variables

  • Implements a processor to ensure input accumulated data has the correct format

  • Updates the interpolator config

Summary of Changes

  • Mass conservation logic
  • pydantic checks to ensure that mass_conservation is setup correctly, with helpful error statements
  • ZeroOverwriter to set LHS boundary to 0 for specific variables
  • Adds Tests for ZeroOverwiter postprocessor, Mass Conservation logic
  • Adds Docs: Getting Stated with interpolator
  • Adds Docs: ZeroOverwriter Postprocessor
  • Ratify config.data.timestep purpose

What issue or task does this change relate to?

#402

Additional notes

As a contributor to the Anemoi framework, please ensure that your changes include unit tests, updates to any affected dependencies and documentation, and have been tested in a parallel setting (i.e., with multiple GPUs). As a reviewer, you are also responsible for verifying these aspects and requesting changes if they are not adequately addressed. For guidelines about those please refer to https://anemoi.readthedocs.io/en/latest/

By opening this pull request, I affirm that all authors agree to the Contributor License Agreement.

@Magnus-SI @radiradev @frazane @sahahner


📚 Documentation preview 📚: https://anemoi-training--544.org.readthedocs.build/en/544/


📚 Documentation preview 📚: https://anemoi-graphs--544.org.readthedocs.build/en/544/


📚 Documentation preview 📚: https://anemoi-models--544.org.readthedocs.build/en/544/

@mchantry mchantry added the ATS Approval Needed Approval needed by ATS label Sep 16, 2025
@Rilwan-Adewoyin Rilwan-Adewoyin changed the title Feat/402 time interpolation mass conserving interpolation for accumulated fields feat/402 time interpolation mass conserving interpolation for accumulated fields Sep 18, 2025
@Rilwan-Adewoyin Rilwan-Adewoyin changed the title feat/402 time interpolation mass conserving interpolation for accumulated fields feat:402 time interpolation mass conserving interpolation for accumulated fields Sep 18, 2025
@anaprietonem anaprietonem self-requested a review October 15, 2025 12:39
@anaprietonem anaprietonem added ATS Approved Approved by ATS and removed ATS Approval Needed Approval needed by ATS labels Oct 20, 2025
@github-actions github-actions bot added the bug Something isn't working label Oct 20, 2025
anaprietonem
anaprietonem previously approved these changes Oct 20, 2025
Copy link
Contributor

@anaprietonem anaprietonem left a comment

Choose a reason for hiding this comment

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

Thanks Rilwan for addressing the comments and the nice work. Before merging it would be good if you can update the branch with main and check tests still pass https://github.com/ecmwf/anemoi-core/actions/runs/18645927148 and https://github.com/ecmwf/anemoi-core/actions/runs/18645957033.

@Rilwan-Adewoyin currently there seems to be some errors with flash_attention - the integration tests are trying to picked that up and failing. Please check that before merging

- diagnostics: evaluation
- hardware: example
- graph: multi_scale
- model: graphtransformer
Copy link
Contributor

@anaprietonem anaprietonem Oct 20, 2025

Choose a reason for hiding this comment

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

the integration tests errors are likely coming from this. We don't test yet the transformer as part of our integration tests, as flash attention can't be installed and we had issues when compiling flex attention. I'd change this back to graph-transformer for now

Copy link
Member Author

Choose a reason for hiding this comment

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

noted, updated in b16e868 - I'll check if tests are now passing soon

@cosunae
Copy link

cosunae commented Oct 21, 2025

Thanks for this contribution @Rilwan-Adewoyin this is very valuable.
Are there scientific results for the evaluation that you could attach to the PR? Perhaps a comparison of an interpolator training with and w/o this mass conserving functionality?

batch: torch.Tensor,
validation_mode: bool = False,
) -> tuple[torch.Tensor, Mapping[str, torch.Tensor]]:
) -> tuple[torch.Tensor, Mapping[str, torch.Tensor], list[torch.Tensor]]:
Copy link
Contributor

Choose a reason for hiding this comment

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

This now doesn't match the signature of the abstract method on the parent class.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for highlighting this - It turns out the abstract method had the wrong signature - it seems that when step is called even the base class expects three outputs in training_step, validation_step as shown below:

train_loss, _, _ = self._step(batch)

I updated the base class _step signature in 99923bc

@Rilwan-Adewoyin
Copy link
Member Author

Thanks for this contribution @Rilwan-Adewoyin this is very valuable. Are there scientific results for the evaluation that you could attach to the PR? Perhaps a comparison of an interpolator training with and w/o this mass conserving functionality?

Hi @cosunae - hope to have experiments detailing this specific thing you've mentioned done by next week. Will update when ready

@HCookie HCookie moved this from To be triaged to Now In Progress in Anemoi-dev Nov 17, 2025
@HCookie HCookie moved this from Now In Progress to Under Review in Anemoi-dev Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ATS Approved Approved by ATS bug Something isn't working models training

Projects

Status: Under Review

Development

Successfully merging this pull request may close these issues.

Time Interpolation: Mass-Conserving Interpolation for Accumulated Fields

9 participants