Models

Encoder Processor Decoder Model

The model defines a graph neural network architecture with configurable encoder, processor, and decoder.

class anemoi.models.models.encoder_processor_decoder.AnemoiModelEncProcDec(*, model_config: DotDict, data_indices: dict, statistics: dict, graph_data: HeteroData)

Bases: Module

Message passing graph neural network.

forward(x: Tensor, model_comm_group: ProcessGroup | None = None) Tensor

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Encoder Hierarchical processor Decoder Model

This model extends the standard encoder-processor-decoder architecture by introducing a hierarchical processor.

Compared to the AnemoiModelEncProcDec model, this architecture requires a predefined list of hidden nodes, [hidden_1, …, hidden_n]. These nodes must be sorted to match the expected flow of information data -> hidden_1 -> … -> hidden_n -> … -> hidden_1 -> data.

A new argument is added to the configuration file: enable_hierarchical_level_processing. This argument determines whether a processor is added at each hierarchy level or only at the final level.

By default, the number of channels for the mappers is defined as 2^n * config.num_channels, where n represents the hierarchy level. This scaling ensures that the processing capacity grows proportionally with the depth of the hierarchy, enabling efficient handling of data.

class anemoi.models.models.hierarchical.AnemoiModelEncProcDecHierarchical(*, model_config: DotDict, data_indices: dict, graph_data: HeteroData)

Bases: AnemoiModelEncProcDec

Message passing hierarchical graph neural network.

forward(x: Tensor, model_comm_group: ProcessGroup | None = None) Tensor

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.