Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #97 from ecmwf/feature/supporting_arrays.py
Browse files Browse the repository at this point in the history
add support for storing numpy arrays in the checkpoints
  • Loading branch information
dietervdb-meteo authored Dec 13, 2024
2 parents fcdd6a7 + 9d73c27 commit 0deb66b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Keep it human-readable, your future self will thank you!
- GraphTransformerMapperBlock chunking to reduce memory usage during inference [#46](https://github.com/ecmwf/anemoi-models/pull/46)
- New `NamedNodesAttributes` class to handle node attributes in a more flexible way [#64](https://github.com/ecmwf/anemoi-models/pull/64)
- Contributors file [#69](https://github.com/ecmwf/anemoi-models/pull/69)
- Added `supporting_arrays` argument, which contains arrays to store in checkpoints. [#97](https://github.com/ecmwf/anemoi-models/pull/97)

### Changed
- Bugfixes for CI
Expand Down
12 changes: 11 additions & 1 deletion src/anemoi/models/interface/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class AnemoiModelInterface(torch.nn.Module):
Statistics for the data.
metadata : dict
Metadata for the model.
supporting_arrays : dict
Numpy arraysto store in the checkpoint.
data_indices : dict
Indices for the data.
pre_processors : Processors
Expand All @@ -48,7 +50,14 @@ class AnemoiModelInterface(torch.nn.Module):
"""

def __init__(
self, *, config: DotDict, graph_data: HeteroData, statistics: dict, data_indices: dict, metadata: dict
self,
*,
config: DotDict,
graph_data: HeteroData,
statistics: dict,
data_indices: dict,
metadata: dict,
supporting_arrays: dict = None,
) -> None:
super().__init__()
self.config = config
Expand All @@ -57,6 +66,7 @@ def __init__(
self.graph_data = graph_data
self.statistics = statistics
self.metadata = metadata
self.supporting_arrays = supporting_arrays if supporting_arrays is not None else {}
self.data_indices = data_indices
self._build_model()

Expand Down

0 comments on commit 0deb66b

Please sign in to comment.