-
Notifications
You must be signed in to change notification settings - Fork 20
feat: Add checkpoint update command #336
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
base: main
Are you sure you want to change the base?
Conversation
01ae1f7
to
db7627b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a bit more explicitness in the naming: redefine-graph
for the command name, and utils/redefine_graph.py
for the utils file?
For a review of the functional implementation maybe @dietervdb-meteo, @frazane and @havardhhaugen would like to have a look?
Co-authored-by: Gert Mertes <13658335+gmertes@users.noreply.github.com>
6086dd4
to
71a8f25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @HCookie this is really helpful. Looks good to me already, though I haven't had time to hands-on test. But we can have a look this week.
anemoi-inference redefine_graph path/to/checkpoint --coords 30.0 -10.0 20.0 0.0 0.1/0.1 --global_resolution n320 | ||
All examples can optionally save the updated graph and checkpoint using the `--save-graph` and `--output` options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you chose to make the output optional? Shouldn't it be a mandatory positional argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For arbitary convenience as it will add a suffix by default and still save it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable. I would clarify this in the docs.
elif args.coords is not None: | ||
local_lats, local_lons = get_coordinates_from_mars_request(args.coords) | ||
else: | ||
raise ValueError("No valid coordinates found.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't be reached if argparse is working correctly but one more check doesn't hurt.
|
||
def check_redefine_imports(): | ||
"""Check if required packages are installed.""" | ||
required_packages = ["anemoi.datasets", "anemoi.graphs", "anemoi.models"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be useful to add these packages to the optional dependencies in the pyproject.toml
, or is it up to the user to install these manually if they want to use this functionality?
Description
For LAM or Nested Grid usage redefining the region or specification of the graph is useful for testing and exploration.
This PR formalises that process within a subcommand to allow easy usage.
It pulls the graph data from the checkpoint to ensure consistency, or allows for a full graph on disk to be used.
Usage
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.
📚 Documentation preview 📚: https://anemoi-inference--336.org.readthedocs.build/en/336/