Skip to content

Conversation

kacpnowak
Copy link
Contributor

Description

Fixes crash when using --forecast_finetune flag by adding materialization of new modules before loading checkpoint

Issue Number

Closes #1029

Checklist before asking for review

  • I have performed a self-review of my code
  • My changes comply with basic sanity checks:
    • I have fixed formatting issues with ./scripts/actions.sh lint
    • I have run unit tests with ./scripts/actions.sh unit-test
    • I have documented my code and I have updated the docstrings.
    • I have added unit tests, if relevant
  • I have tried my changes with data and code:
    • I have run the integration tests with ./scripts/actions.sh integration-test
    • (bigger changes) I have run a full training and I have written in the comment the run_id(s): launch-slurm.py --time 60
    • (bigger changes and experiments) I have shared a hegdedoc in the github issue with all the configurations and runs for this experiments
  • I have informed and aligned with people impacted by my change:
    • for config changes: the MatterMost channels and/or a design doc
    • for changes of dependencies: the MatterMost software development channel

@clessig
Copy link
Collaborator

clessig commented Oct 6, 2025

The --forecast_finetune flag is deprecated.

@clessig
Copy link
Collaborator

clessig commented Oct 13, 2025

Is this ready for review?

@kacpnowak
Copy link
Contributor Author

Yes

)

model_state_dict = self.model.state_dict()
params = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment explaining this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I wanna test this with a couple configs and then I will approve it

Copy link
Contributor

@sophie-xhonneux sophie-xhonneux left a comment

Choose a reason for hiding this comment

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

This is a good fix. It is not fully complete as I think with new encoders/decoders that have the same parameter shapes as the existing model there will be issues, but this cannot be solved until embedding engines, prediction heads, etc are named according to the stream names they belong to. This issue is for a new PR.

@sophie-xhonneux
Copy link
Contributor

Note I test with pre-training on ERA5 and continuing with ERA5, NPPATMS, & SYNOP on 2 GPUs

@sophie-xhonneux sophie-xhonneux merged commit aae0b8a into ecmwf:develop Oct 13, 2025
5 checks passed
sophie-xhonneux pushed a commit that referenced this pull request Oct 17, 2025
* Add materialisation of new modules before loading checkpoint

* Initialize new modules in load_model

* Fix adding new embedding networks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Finetuning for forecasting leads to error with parameter materialization in FSDP2

3 participants