Skip to content

Validate checkpoint against inference environment #201

Merged
elcarpenterNOAA merged 18 commits into
mainfrom
validate-checkpoint
Jul 1, 2026
Merged

Validate checkpoint against inference environment #201
elcarpenterNOAA merged 18 commits into
mainfrom
validate-checkpoint

Conversation

@elcarpenterNOAA

Copy link
Copy Markdown
Contributor

Description:

Fixes #146.

Type of change:

  • Enhancement / new feature
  • Documentation

Area(s) affected

  • nested_eagle workflow
  • Inference
  • Config (YAML)

Commit Requirements:

  • This PR addresses a relevant NOAA-EPIC/EAGLE issue (if not, create an issue); a person responsible for submitting the update has been assigned to the issue (link issue)
  • Fill out all sections of this template.
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • I have made corresponding changes to the system documentation if necessary
  • I checked whether this PR requires subcomponent PRs and completed the subcomponent checklist below

Testing / Verification:

  • I ran and/or verified the changes (or provided a test plan)
  • Commands/config used: Quickstart on Ursa

@github-actions

Copy link
Copy Markdown

Link to ReadTheDocs sample build for this PR can be found at:
https://epic-eagle--201.org.readthedocs.build/en/201

Comment on lines +34 to +37
if self.config.get("validate", True):
yield self.valid_checkpoint(ckpt_path)
else:
yield self._checkpoint(ckpt_path)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Validate the checkpoint if it is set to true or if validate: is not provided, otherwise just check that the checkpoint path exists, as we previously did for all runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is valid_checkpoint intentionally public so that it could be selected externally as one of the driver's tasks? I noticed the difference between this and the private _checkpoint.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. I would think it'll be fairly common to use previously trained checkpoints, and would be helpful for users to have a task for, whereas checking if the file path exists seems a bit odd to have as a task.

Comment on lines +17 to +19
},
"validate": {
"type": "boolean"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Optional value.

@elcarpenterNOAA
elcarpenterNOAA marked this pull request as ready for review June 30, 2026 21:19
@elcarpenterNOAA
elcarpenterNOAA requested a review from a team as a code owner June 30, 2026 21:19
@github-actions github-actions Bot added the ci-running CI is running on this pull request label Jun 30, 2026
Comment on lines +34 to +37
if self.config.get("validate", True):
yield self.valid_checkpoint(ckpt_path)
else:
yield self._checkpoint(ckpt_path)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is valid_checkpoint intentionally public so that it could be selected externally as one of the driver's tasks? I noticed the difference between this and the private _checkpoint.

assert not cfgfile.is_file()
driverobj.anemoi_config()
with patch.object(driverobj, "valid_checkpoint", return_value=None):
driverobj.anemoi_config()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this meant to prevent valid_checkpoint from becoming part of the task graph, necessary because the new validate item is missing from the test-fixture config and missing implies True? If so, would something like

driverobj._config["validate"] = False

also work? This test has some driverobj._config tweaks a few lines above.

Same question applies to the update in test_anemoi_config__explicit_checkpoint, below.

EDIT: I now see that you're doing = False in test_anemoi_config__validate_false further down, so maybe I don't understand the intent of the mock in these two tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The intention was for this function to test the default case: validate: true, but to mock it so that anemoi-inference doesn't check the validity of a dummy checkpoint, which would always fail. We can't maintain checkpoints in the repo for testing purposes, so this seemed like the best option at the time. The same would apply to test_anemoi_config__explicit_checkpoint.

test_anemoi_config__validate_false is meant to test the exception, and a test is needed to cover that exception for branch coverage.

@github-actions github-actions Bot removed the ci-running CI is running on this pull request label Jun 30, 2026
@github-actions github-actions Bot added ci-running CI is running on this pull request and removed ci-running CI is running on this pull request labels Jun 30, 2026
@github-actions github-actions Bot added ci-running CI is running on this pull request and removed ci-running CI is running on this pull request labels Jul 1, 2026

@maddenp-cu maddenp-cu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like the current CI failure might be a transient upstream issue that a re-run will resolve.

@github-actions github-actions Bot added ci-running CI is running on this pull request and removed ci-running CI is running on this pull request labels Jul 1, 2026
@elcarpenterNOAA

elcarpenterNOAA commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@maddenp-cu Do you know what branch protection rule I'm breaking? I can bypass the requirement manually, but I'm wondering if everything was set up correctly. This is a branch from the main repo, not my fork, which to my understanding we are moving to, but aren't there yet.

@maddenp-cu

Copy link
Copy Markdown
Contributor

@maddenp-cu Do you know what branch protection rule I'm breaking? I can bypass the requirement manually, but I'm wondering if everything was set up correctly. This is a branch from the main repo, not my fork, which to my understanding we are moving to, but aren't there yet.

@elcarpenterNOAA Are you clear to merge now? There was a too-strict prohibition on updating main, which is, I think, exactly what merging a PR does. I unchecked that option.

@elcarpenterNOAA
elcarpenterNOAA merged commit 8248b00 into main Jul 1, 2026
13 of 19 checks passed
@elcarpenterNOAA

Copy link
Copy Markdown
Contributor Author

@maddenp-cu Yes, thank you! And my apologies: I forgot I also had the ability to edit branch protection rules.

@elcarpenterNOAA
elcarpenterNOAA deleted the validate-checkpoint branch July 1, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider validating checkpoint before inference

2 participants