Schemas

This module defines pydantic schemas, which are used to validate the configuration before a training run is started. The top-level config yaml matches the BaseSchema.

class anemoi.training.schemas.base_schema.BaseSchema

Bases: SchemaCommonMixin, BaseModel

Top-level schema for the training configuration.

data: DataSchema

Data configuration.

dataloader: DataLoaderSchema

Dataloader configuration.

diagnostics: DiagnosticsSchema

Diagnostics configuration such as logging, plots and metrics.

system: SystemSchema

System configuration, including filesystem and hardware specification.

graph: BaseGraphSchema

Graph configuration.

model: BaseModelSchema | EnsModelSchema | HierarchicalModelSchema | TransportModelSchema | TransportTendModelSchema

Model configuration.

training: Annotated[Annotated[SingleTrainingSchema, Tag(tag=anemoi.training.train.methods.SingleTraining)] | Annotated[EnsembleTrainingSchema, Tag(tag=anemoi.training.train.methods.EnsembleTraining)] | Annotated[TransportTrainingSchema, Tag(tag=anemoi.training.train.methods.TransportTraining)], Discriminator(discriminator=_training_method_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]

Training configuration.

config_validation: bool

Flag to disable validation of the configuration

check_frequency_null_for_trajectory_datasets() → Self

Assert data.frequency is null when any trajectory (forecast) dataset is configured.

check_bounding_not_used_with_data_extractor_zero() → Self

Check that bounding is not used with zero data extractor.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

anemoi.training.schemas.base_schema.BaseSchema.task

Task configuration.

The below schemas are organised below identically to the training config files,

Data

class anemoi.training.schemas.data.DatasetDataSchema(*, forcing: list[str] = <factory>, diagnostic: list[str] = <factory>, target: list[str] | None = None, processors: dict[str, ~anemoi.models.schemas.data_processor.PreprocessorSchema], spatial_processor: ~anemoi.models.schemas.spatial_processors.CrossGridProjectorSchema | None = None)

Bases: BaseModel

A class used to represent the configuration of a single dataset.

forcing: list[str]

Features that are not part of the forecast state but are used as forcing to generate the forecast state.

diagnostic: list[str]

Features that are only part of the forecast state and are not used as an input to the model.

target: list[str] | None

prognostic = diagnostic - forcing.union(target).

Type:

Features used to compute the loss against forecasted variables. Cannot be prognostic or diagnostic, can have the same name as forcing variables but have a different role. Such that

processors: dict[str, PreprocessorSchema]

Layers of model performing computation on latent space. Processors including imputers and normalizers are applied in order of definition. (single dataset mode)

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spatial_processor: SpatialProcessorSchema | None

Spatial preprocessor applied to this dataset before normalization (e.g. CrossGridProjector for downscaling). May change the grid dimension.

class anemoi.training.schemas.data.DataSchema(*, format: str, frequency: str | None = None, datasets: dict[str, DatasetDataSchema] | None = None)

Bases: BaseModel

A class used to represent the overall configuration of the dataset(s).

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

format: str

Format of the data.

frequency: str | None

Time frequency requested from the dataset. Must be null when using trajectory (forecast) datasets.

datasets: dict[str, DatasetDataSchema] | None

Dictionary mapping dataset names to their configurations.

Dataloader

class anemoi.training.schemas.dataloader.Frequency(root: RootModelRootType = PydanticUndefined)

Bases: RootModel

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.dataloader.DatasetConfigSchema(*, dataset: str | Path | dict | list[dict], frequency: Frequency | None = None, drop: list[str] | None = None, select: list[str] | None = None, statistics: str | Path | None = None, step_start: Annotated[int, Ge(ge=0)] | None = None, step_end: Annotated[int, Gt(gt=0)] | None = None, step_frequency: Annotated[int, Gt(gt=0)] | None = None, **extra_data: Any)

Bases: BaseModel

Dictionary-style dataset config passed directly to open_dataset.

model_config = {'arbitrary_types_allowed': True, 'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

dataset: str | Path | dict | list[dict]

Dataset source identifier.

frequency: Frequency | None

Optional frequency requested from open_dataset.

drop: list[str] | None

Optional list of variables to drop from the dataset.

select: list[str] | None

Optional list of variables to select from the dataset.

statistics: str | Path | None

Optional path to custom statistics file.

step_start: Annotated[int, Ge(ge=0)] | None

First forecast step to include, in hours (inclusive). Selects ForecastStepDataset when set.

step_end: Annotated[int, Gt(gt=0)] | None

Last forecast step to include, in hours (inclusive). Selects ForecastStepDataset when set.

step_frequency: Annotated[int, Gt(gt=0)] | None

Stride between selected forecast steps, in hours. Selects ForecastStepDataset when set.

class anemoi.training.schemas.dataloader.NativeDatasetSchema(*, dataset_config: str | DatasetConfigSchema | Path | list[dict] | None = None, start: str | int | None = None, end: str | int | None = None)

Bases: BaseModel

Dataset configuration schema.

dataset_config: str | DatasetConfigSchema | Path | list[dict] | None

Dataset definition passed to open_dataset.

start: str | int | None

Starting datetime for sample of the dataset.

end: str | int | None

Ending datetime [inclusive] for sample of the dataset.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.dataloader.TrajectorySamplingSchema(*, stride: int | None = None)

Bases: BaseModel

Trajectory anchor sampling configuration.

stride: int | None

Stride between anchor positions. None = window size (non-overlapping); 1 = every position.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.dataloader.TrajectorySchema(*, sampling: TrajectorySamplingSchema | None = None)

Bases: BaseModel

Trajectory (forecast) reader configuration for 5-D trajectory zarr datasets.

sampling: TrajectorySamplingSchema | None

Anchor sampling config. stride=None → non-overlapping; stride=1 → all; stride=N → step N.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.dataloader.TrajectoryDatasetSchema(*, dataset_config: str | DatasetConfigSchema | Path | list[dict] | None = None, start: str | int | None = None, end: str | int | None = None, trajectory: TrajectorySchema | None = None)

Bases: NativeDatasetSchema

Dataset configuration schema.

trajectory: TrajectorySchema | None

Trajectory configuration.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.dataloader.LoaderSet(*, training: Annotated[int, Ge(ge=0)] | None, validation: Annotated[int, Ge(ge=0)] | None, test: Annotated[int, Ge(ge=0)] | None)

Bases: BaseModel

training: Annotated[int, Ge(ge=0)] | None

Value for training dataset

validation: Annotated[int, Ge(ge=0)] | None

Value for validation dataset

test: Annotated[int, Ge(ge=0)] | None

Value for test dataset

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.dataloader.DataLoadingPolicySchema(*, _target_: str = 'anemoi.training.data.loading.SynchronizedLoadingPolicy', **extra_data: Any)

Bases: GenericSchema

Hydra instantiation config for the DataLoadingPolicy that builds the dataset and batch sampler for each stage.

model_config = {'extra': 'allow', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_: str

Hydra target class of the policy.

class anemoi.training.schemas.dataloader.DataLoaderSchema(*, prefetch_factor: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)], pin_memory: bool, persistent_workers: bool = False, fake_dataloading: bool = False, loading_policy: ~anemoi.training.schemas.dataloader.DataLoadingPolicySchema = <factory>, num_workers: ~anemoi.training.schemas.dataloader.LoaderSet, batch_size: ~anemoi.training.schemas.dataloader.LoaderSet, limit_batches: ~anemoi.training.schemas.dataloader.LoaderSet, training: dict[~typing.Literal['datasets'], dict[str, ~anemoi.training.schemas.dataloader.NativeDatasetSchema | ~anemoi.training.schemas.dataloader.TrajectoryDatasetSchema]] | ~anemoi.training.schemas.dataloader.NativeDatasetSchema | ~anemoi.training.schemas.dataloader.TrajectoryDatasetSchema, validation: dict[~typing.Literal['datasets'], dict[str, ~anemoi.training.schemas.dataloader.NativeDatasetSchema | ~anemoi.training.schemas.dataloader.TrajectoryDatasetSchema]] | ~anemoi.training.schemas.dataloader.NativeDatasetSchema | ~anemoi.training.schemas.dataloader.TrajectoryDatasetSchema, test: dict[~typing.Literal['datasets'], dict[str, ~anemoi.training.schemas.dataloader.NativeDatasetSchema | ~anemoi.training.schemas.dataloader.TrajectoryDatasetSchema]] | ~anemoi.training.schemas.dataloader.NativeDatasetSchema | ~anemoi.training.schemas.dataloader.TrajectoryDatasetSchema, read_group_size: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)], trajectory_sampling: ~anemoi.training.schemas.dataloader.TrajectorySamplingSchema | None = None, multiprocessing_context: str | None = None, **extra_data: ~typing.Any)

Bases: BaseModel

model_config = {'arbitrary_types_allowed': True, 'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

prefetch_factor: int

Number of batches loaded in advance by each worker.

pin_memory: bool

If True, the data loader will copy Tensors into device/CUDA pinned memory before returning them.

persistent_workers: bool

Keep dataloader workers alive between epochs instead of starting new ones every epoch.

fake_dataloading: bool

Load one real sample per worker and reuse it for subsequent accesses.

loading_policy: DataLoadingPolicySchema

Hydra config for the DataLoadingPolicy that builds the dataset and batch sampler for each stage.

num_workers: LoaderSet

Number of process per-GPU for batch distribution.

batch_size: LoaderSet

Per-GPU batch size.

limit_batches: LoaderSet

Limit number of batches to run. Default value null, will run on all the batches.

training: dict[Literal['datasets'], dict[str, NativeDatasetSchema | TrajectoryDatasetSchema]] | NativeDatasetSchema | TrajectoryDatasetSchema

Training DatasetSchema.

validation: dict[Literal['datasets'], dict[str, NativeDatasetSchema | TrajectoryDatasetSchema]] | NativeDatasetSchema | TrajectoryDatasetSchema

Validation DatasetSchema.

test: dict[Literal['datasets'], dict[str, NativeDatasetSchema | TrajectoryDatasetSchema]] | NativeDatasetSchema | TrajectoryDatasetSchema

Test DatasetSchema.

read_group_size: Annotated[int, Gt(gt=0)]

Number of GPUs per reader group. Defaults to number of GPUs (see BaseSchema validators).

trajectory_sampling: TrajectorySamplingSchema | None

Default trajectory anchor sampling used across all splits. stride=None → non-overlapping; stride=N → step N.

multiprocessing_context: str | None

Multiprocessing context to use for workers. If None, the default context will be used

Diagnostics

class anemoi.training.schemas.diagnostics.GraphPlotFnSchema(*, _target_: str, _partial_: bool = True, **extra_data: Any)

Bases: GenericSchema

Hydra config for a GraphFeaturePlot plot function.

The _target_ must resolve to a callable that accepts at minimum: dataset_name, node_attributes, node_trainable_tensors, edge_trainable_modules. See GraphPlotFn for the full contract.

Built-in graph plot options

  • anemoi.training.diagnostics.evaluation.plotting.graph.graph_plot_fn

Custom functions are accepted — pass any dotted import path and bind extra kwargs via _partial_: true.

partial_: bool

Must be true — the callback binds the remaining arguments at call time.

model_config = {'extra': 'allow', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.LossPlotFnSchema(*, _target_: str, _partial_: bool = True, **extra_data: Any)

Bases: GenericSchema

Hydra config for a LossCurvePlot plot function.

The _target_ must resolve to a callable that accepts at minimum: loss and parameter_names. See LossPlotFn for the full contract.

Built-in loss plot options

  • anemoi.training.diagnostics.evaluation.plotting.loss.loss_plot_fn

Custom functions are accepted — pass any dotted import path and bind extra kwargs via _partial_: true.

partial_: bool

Must be true — the callback binds the remaining arguments at call time.

model_config = {'extra': 'allow', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.GraphFeaturePlotSchema(*, _target_: ~typing.Literal['anemoi.training.diagnostics.callbacks.plot.GraphFeaturePlot'], dataset_names: list[str] = <factory>, every_n_epochs: int | None, q_extreme_limit: float = 0.05, plot_fn: ~anemoi.training.schemas.diagnostics.GraphPlotFnSchema | None = None, **extra_data: ~typing.Any)

Bases: BaseModel

Config schema for GraphFeaturePlot.

Users may plug in a custom plot_fn (matching the pluggable pattern shared with BatchOutputPlot and LossCurvePlot) without extending this schema (extra='allow' on the nested plot_fn).

model_config = {'extra': 'allow', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_: Literal['anemoi.training.diagnostics.callbacks.plot.GraphFeaturePlot']

GraphFeaturePlot object from anemoi training diagnostics callbacks.

dataset_names: list[str]

List of dataset names to plot. Defaults to ['data'].

every_n_epochs: int | None

Epoch frequency to plot at.

q_extreme_limit: float

Quantile edges to represent (used by default plot_fn).

plot_fn: GraphPlotFnSchema | None

Hydra-instantiable plot function (use _partial_: true). None uses the default.

class anemoi.training.schemas.diagnostics.FocusAreaSchema(*, name: str | None = None, mask_attr_name: str | None = None, latlon_bbox: Annotated[list[float] | None, MinLen(min_length=4), MaxLen(max_length=4)] = None)

Bases: BaseModel

name: str | None

Name of the focus_area, will be used for plot naming.

mask_attr_name: str | None

Name of the node attribute to use as masking. eg. cutout_mask

latlon_bbox: list[float] | None

Latitude and longitude bounds as [lat_min, lon_min, lat_max, lon_max].

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.LossCurvePlotSchema(*, _target_: ~typing.Literal['anemoi.training.diagnostics.callbacks.plot.LossCurvePlot'], dataset_names: list[str] = <factory>, parameter_groups: dict[str, list[str]], every_n_batches: int | None = None, plot_fn: ~anemoi.training.schemas.diagnostics.LossPlotFnSchema | None = None, **extra_data: ~typing.Any)

Bases: BaseModel

Config schema for LossCurvePlot.

Users may plug in a custom plot_fn (matching the pluggable pattern shared with BatchOutputPlot) without extending this schema (extra='allow' on the nested plot_fn).

model_config = {'extra': 'allow', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_: Literal['anemoi.training.diagnostics.callbacks.plot.LossCurvePlot']

LossCurvePlot object from anemoi training diagnostics callbacks.

dataset_names: list[str]

List of dataset names to plot. Defaults to ['data'].

parameter_groups: dict[str, list[str]]

Dictionary with parameter groups with parameter names as key.

every_n_batches: int | None

Batch frequency to plot at.

plot_fn: LossPlotFnSchema | None

Hydra-instantiable plot function (use _partial_: true). None uses the default.

class anemoi.training.schemas.diagnostics.MatplotlibColormapSchema(*, _target_: Literal['anemoi.training.utils.custom_colormaps.MatplotlibColormap'], name: str, variables: list[str] | None = None)

Bases: BaseModel

target_: Literal['anemoi.training.utils.custom_colormaps.MatplotlibColormap']

CustomColormap object from anemoi training utils.

name: str

Name of the Matplotlib colormap.

variables: list[str] | None

A list of strings representing the variables for which the colormap is used, by default None.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.MatplotlibColormapClevelsSchema(*, _target_: Literal['anemoi.training.utils.custom_colormaps.MatplotlibColormapClevels'], clevels: list, variables: list[str] | None = None)

Bases: BaseModel

target_: Literal['anemoi.training.utils.custom_colormaps.MatplotlibColormapClevels']

CustomColormap object from anemoi training utils.

clevels: list

The custom color levels for the colormap.

variables: list[str] | None

A list of strings representing the variables for which the colormap is used, by default None.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.DistinctipyColormapSchema(*, _target_: Literal['anemoi.training.utils.custom_colormaps.DistinctipyColormap'], n_colors: int, variables: list[str] | None = None, colorblind_type: str | None = None)

Bases: BaseModel

target_: Literal['anemoi.training.utils.custom_colormaps.DistinctipyColormap']

CustomColormap object from anemoi training utils.

n_colors: int

The number of colors in the colormap.

variables: list[str] | None

A list of strings representing the variables for which the colormap is used, by default None.

colorblind_type: str | None

The type of colorblindness to simulate. If None, the default colorblindness from distinctipy is applied.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.BatchOutputPlotFnSchema(*, _target_: str, _partial_: bool = True, **extra_data: Any)

Bases: GenericSchema

Hydra config for a BatchOutputPlot plot function.

The _target_ must resolve to a callable that accepts at minimum: parameters, x, y_true, y_pred, latlons. See BatchOutputPlotFn for the full contract.

Built-in batch output plot options

  • anemoi.training.diagnostics.evaluation.plotting.batch_output.sample_plot_fn

  • anemoi.training.diagnostics.evaluation.plotting.batch_output.spectrum_plot_fn

  • anemoi.training.diagnostics.evaluation.plotting.batch_output.histogram_plot_fn

  • anemoi.training.diagnostics.evaluation.plotting.batch_output.ensemble_plot_fn

Custom functions are accepted — pass any dotted import path and bind extra kwargs via _partial_: true.

partial_: bool

Must be true — the callback binds the remaining arguments at call time.

model_config = {'extra': 'allow', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.BatchOutputPlotSchema(*, _target_: ~typing.Literal['anemoi.training.diagnostics.callbacks.plot.BatchOutputPlot'], tag_infix: str, sample_idx: int, parameters: list[str], plot_fn: ~anemoi.training.schemas.diagnostics.BatchOutputPlotFnSchema, with_auxiliary: bool = False, members: list[int] | int | None = None, dataset_names: list[str] = <factory>, every_n_batches: int | None = None, focus_area: ~anemoi.training.schemas.diagnostics.FocusAreaSchema | None = None, **extra_data: ~typing.Any)

Bases: BaseModel

Config-driven batch-output plot callback.

Users may subclass or supply a custom plot_fn by pointing _target_ to their own function. Signature validation happens at runtime in BatchOutputPlot.__init__().

model_config = {'extra': 'allow', 'populate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_: Literal['anemoi.training.diagnostics.callbacks.plot.BatchOutputPlot']

BatchOutputPlot object from anemoi training diagnostics callbacks.

tag_infix: str

Short tag inserted into logged artifact names.

sample_idx: int

Index of sample within the batch to plot.

parameters: list[str]

Model output parameters to include in the plot.

plot_fn: BatchOutputPlotFnSchema

Hydra-instantiable plot function (use _partial_: true).

with_auxiliary: bool

Forward the auxiliary tensor (e.g. corrupted targets) to plot_fn.

members: list[int] | int | None

Ensemble members to select; None means adapter default (all for ensembles).

dataset_names: list[str]

List of dataset names to plot. Defaults to ['data'].

every_n_batches: int | None

Batch frequency to plot at, by default None.

focus_area: FocusAreaSchema | None

Region of interest to restrict plots to.

class anemoi.training.schemas.diagnostics.PlottingFrequency(*, batch: Annotated[int, Gt(gt=0)], epoch: Annotated[int, Gt(gt=0)])

Bases: BaseModel

batch: Annotated[int, Gt(gt=0)]

Frequency of the plotting in number of batches.

epoch: Annotated[int, Gt(gt=0)]

Frequency of the plotting in number of epochs.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.PlotSettingsSchema(*, asynchronous: bool = True, datashader: bool = True, projection_kind: str = 'equirectangular', colormaps: dict | None = None, precip_and_related_fields: list[str] | None = None)

Bases: BaseModel

Rendering settings shared across all plot callbacks in a run.

These map 1:1 to PlottingSettings in plot.py and are read from the diagnostics.plot.settings config sub-node.

asynchronous: bool

Handle plotting tasks without blocking the model training.

datashader: bool

Use Datashader to plot.

projection_kind: str

Map projection for diagnostics plots.

Built-in options: 'equirectangular' (no cartopy required) and 'lambert_conformal' (auto-fitted to the data domain; requires cartopy). Any cartopy.crs class name in snake_case is also accepted (e.g. 'robinson', 'mollweide', 'orthographic'); these require cartopy and are instantiated with default constructor arguments (e.g. 'orthographic' centres on longitude/latitude 0). If you need non-default parameters, use 'lambert_conformal' (auto-fitted to the data domain) or subclass MapProjection. Must be 'equirectangular' when datashader is True.

colormaps: dict | None

Variable-specific colormaps keyed by ‘default’, ‘error’, or variable name group.

Names of precipitation and related fields that use a special colormap.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.PlotSchema(*, settings: ~anemoi.training.schemas.diagnostics.PlotSettingsSchema = <factory>, callbacks: list[~types.Annotated[~anemoi.training.schemas.diagnostics.GraphFeaturePlotSchema | ~anemoi.training.schemas.diagnostics.LossCurvePlotSchema | ~anemoi.training.schemas.diagnostics.BatchOutputPlotSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]], focus_areas: dict | None = None, datasets_to_plot: list[str] | None = None)

Bases: BaseModel

settings: PlotSettingsSchema

Rendering settings (datashader, projection, colormaps, etc.).

callbacks: list[Annotated[GraphFeaturePlotSchema | LossCurvePlotSchema | BatchOutputPlotSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]]

List of plotting functions to call.

focus_areas: dict | None

Named spatial focus areas (lat/lon bounding boxes or node attribute masks).

datasets_to_plot: list[str] | None

Dataset names to include in plots.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.TimeLimitSchema(*, _target_: Literal['anemoi.training.diagnostics.callbacks.stopping.TimeLimit'], limit: int | str, record_file: str | None = None)

Bases: BaseModel

target_: Literal['anemoi.training.diagnostics.callbacks.stopping.TimeLimit']

TimeLimit object from anemoi training diagnostics callbacks.

limit: int | str

Time limit, if int, assumed to be hours, otherwise must be a string with units (e.g. ‘1h’, ‘30m’).

record_file: str | None

File to record the last checkpoint to on exit, if set.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.EarlyStoppingSchema(*, _target_: Literal['anemoi.training.diagnostics.callbacks.stopping.EarlyStopping'], monitor: str, min_delta: float = 0.0, patience: int = 3, verbose: bool = False, mode: Literal['min', 'max'] = 'min', strict: bool = True, check_finite: bool = True, stopping_threshold: float | None = None, divergence_threshold: float | None = None, check_on_train_epoch_end: bool | None = None)

Bases: BaseModel

monitor: str

Metric to monitor

min_delta: float

Minimum change in the monitored quantity to qualify as an improvement.

patience: int

Number of epochs with no improvement after which training will be stopped.

verbose: bool

If True, prints a message for each improvement.

mode: Literal['min', 'max']

One of {‘min’, ‘max’}, changes if minimisation or maximimisation of the metric is ‘good’.

strict: bool

Whether to crash the training if the monitored quantity is not found.

check_finite: bool

Whether to check for NaNs and Infs in the monitored quantity.

stopping_threshold: float | None

Stop training immediately once the monitored quantity reaches this threshold.

divergence_threshold: float | None

Stop training as soon as the monitored quantity becomes worse than this threshold..

check_on_train_epoch_end: bool | None

Whether to check the stopping criteria at the end of each training epoch.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.Debug(*, anomaly_detection: bool)

Bases: BaseModel

anomaly_detection: bool

Activate anomaly detection. This will detect and trace back NaNs/Infs, but slow down training.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.CheckpointingSchema(*, save_frequency: int | None, num_models_saved: int)

Bases: BaseModel

save_frequency: int | None

Frequency at which to save the checkpoints.

num_models_saved: int

Number of model checkpoint to save. Only the last num_models_saved checkpoints will be kept. If set to -1, all checkpoints are kept

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.CheckpointSchema(*, every_n_minutes: CheckpointingSchema | None = None, every_n_epochs: CheckpointingSchema | None = None, every_n_train_steps: CheckpointingSchema | None = None, exclude_hyperparameters: list[str] = <factory>)

Bases: BaseModel

every_n_minutes: CheckpointingSchema | None

Checkpointing by time interval.

every_n_epochs: CheckpointingSchema | None

Checkpointing by epoch frequency.

every_n_train_steps: CheckpointingSchema | None

Checkpointing by training step frequency.

exclude_hyperparameters: list[str]

Init arguments of the training module not to store as hyperparameters in the checkpoint. Only ‘graph_data’ can be excluded; converting the checkpoint with anemoi-training checkpoint inference then requires the graph through –graph.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.diagnostics.WandbSchema(*, _target_: Literal['pytorch_lightning.loggers.wandb.WandbLogger'] = 'pytorch_lightning.loggers.wandb.WandbLogger', enabled: bool, offline: bool, log_model: bool | Literal['all'], project: str, gradients: bool, parameters: bool, entity: str | None = None, interval: Annotated[int, Gt(gt=0)] | None = 100)

Bases: BaseModel

enabled: bool

Use Weights & Biases logger.

offline: bool

Run W&B offline.

log_model: bool | Literal['all']

Log checkpoints created by ModelCheckpoint as W&B artifacts. If True, checkpoints are logged at the end of training. If ‘all’, checkpoints are logged during training.

project: str

The name of the project to which this run will belong.

gradients: bool

Whether to log the gradients.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

parameters: bool

Whether to log the hyper parameters.

entity: str | None

Username or team name where to send runs. This entity must exist before you can send runs there.

interval: Annotated[int, Gt(gt=0)] | None

Logging frequency in batches.

class anemoi.training.schemas.diagnostics.MlflowSchema(*, _target_: ~typing.Literal['anemoi.training.diagnostics.mlflow.logger.AnemoiMLflowLogger'] = 'anemoi.training.diagnostics.mlflow.logger.AnemoiMLflowLogger', enabled: bool, offline: bool, authentication: bool, log_model: bool | ~typing.Literal['all'] | None = None, tracking_uri: str | None = None, experiment_name: str, project_name: str, system: bool, terminal: bool, run_name: str | None, prefix: str = '', log_hyperparams: bool = True, on_resume_create_child: bool, expand_hyperparams: list[str] = <factory>, http_max_retries: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)], max_params_length: int = 2000, save_dir: str | None = None)

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

enabled: bool

Use MLflow logger.

offline: bool

Run MLflow offline. Necessary if no internet access available.

authentication: bool

Whether to authenticate with server or not

log_model: bool | Literal['all'] | None

Log checkpoints created by ModelCheckpoint as MLFlow artifacts. If True, checkpoints are logged at the end of training. If ‘all’, checkpoints are logged during training.

tracking_uri: str | None

Address of local or remote tracking server.

experiment_name: str

Name of experiment.

project_name: str

Name of project.

system: bool

Activate system metrics.

terminal: bool

Log terminal logs to MLflow.

run_name: str | None

Name of run.

prefix: str

Prefix for metric keys logged to MLflow.

log_hyperparams: bool

Whether to log hyperparameters.

on_resume_create_child: bool

Whether to create a child run when resuming a run.

expand_hyperparams: list[str]

Keys to expand within params. Any key being expanded will have lists converted according to expand_iterables.

http_max_retries: Annotated[int, Gt(gt=0)]

Specifies the maximum number of retries for MLflow HTTP requests, default 35.

max_params_length: int

Maximum number of hpParams to be logged with mlflow

save_dir: str | None

Directory to save logs to when offline=True, default={system.output.root}/{system.output.logs.mlflow}

class anemoi.training.schemas.diagnostics.AzureMlflowSchema(*, _target_: ~typing.Literal['anemoi.training.diagnostics.mlflow.azureml.AnemoiAzureMLflowLogger'], enabled: bool, offline: ~typing.Literal[False], authentication: bool, log_model: bool | ~typing.Literal['all'] | None = None, tracking_uri: str | None = None, experiment_name: str, project_name: str, system: bool, terminal: ~typing.Literal[False], run_name: str | None, prefix: str = '', log_hyperparams: bool = True, on_resume_create_child: bool, expand_hyperparams: list[str] = <factory>, http_max_retries: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)], max_params_length: int = 2000, save_dir: str | None = None, identity: str | None = None, resource_group: str | None = None, workspace_name: str | None = None, subscription_id: str | None = None, azure_log_level: str = 'WARNING')

Bases: MlflowSchema

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

offline: Literal[False]

Run MLflow offline. Necessary if no internet access available.

terminal: Literal[False]

Log terminal logs to MLflow.

identity: str | None

Type of identity to use for logging in with Azure ML.

resource_group: str | None

Name of the AzureML resource group

workspace_name: str | None

Name of the AzureML workspace

subscription_id: str | None

AzureML subscription ID

azure_log_level: str

Log level for all azure packages (azure-identity, azure-core, etc)

class anemoi.training.schemas.diagnostics.LoggingSchema(*, wandb: WandbSchema | None = None, mlflow: MlflowSchema | AzureMlflowSchema | None = None, interval: Annotated[int, Gt(gt=0)])

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

wandb: WandbSchema | None

W&B logging schema.

mlflow: Annotated[MlflowSchema | AzureMlflowSchema | None, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]

MLflow logging schema.

interval: Annotated[int, Gt(gt=0)]

Logging frequency in batches.

class anemoi.training.schemas.diagnostics.MemorySchema(*, enabled: bool, steps: Annotated[int, Gt(gt=0)], warmup: Annotated[int, Ge(ge=0)], extra_plots: bool, trace_rank0_only: bool)

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

enabled: bool

Enable memory report. Default to false.

steps: Annotated[int, Gt(gt=0)]

Frequency of memory profiling. Default to 5.

warmup: Annotated[int, Ge(ge=0)]

Number of step to discard before the profiler starts to record traces. Default to 2.

extra_plots: bool

Save plots produced with torch.cuda._memory_viz.profile_plot if available. Default to false.

trace_rank0_only: bool

Trace only rank 0 from SLURM_PROC_ID. Default to false.

class anemoi.training.schemas.diagnostics.Snapshot(*, enabled: bool, steps: Annotated[int, Gt(gt=0)], warmup: Annotated[int, Ge(ge=0)])

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

enabled: bool

Enable memory snapshot recording. Default to false.

steps: Annotated[int, Gt(gt=0)]

Frequency of snapshot. Default to 4.

warmup: Annotated[int, Ge(ge=0)]

Number of step to discard before the profiler starts to record traces. Default to 0.

class anemoi.training.schemas.diagnostics.Profiling(*, enabled: bool, verbose: bool | None = None)

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

enabled: bool

Enable component profiler. Default to false.

verbose: bool | None

Set to true to include the full list of profiled action or false to keep it concise.

class anemoi.training.schemas.diagnostics.BenchmarkProfilerSchema(*, memory: MemorySchema = <factory>, time: Profiling = <factory>, speed: Profiling = <factory>, system: Profiling = <factory>, model_summary: Profiling = <factory>, snapshot: Snapshot = <factory>)

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

memory: MemorySchema

Schema for memory report containing metrics associated with CPU and GPU memory allocation.

time: Profiling

Report with metrics of execution time for certain steps across the code.

speed: Profiling

Report with metrics of execution speed at training and validation time.

system: Profiling

Report with metrics of GPU/CPU usage, memory and disk usage and total execution time.

model_summary: Profiling

Table summary of layers and parameters of the model.

snapshot: Snapshot

Memory snapshot if torch.cuda._record_memory_history is available.

class anemoi.training.schemas.diagnostics.ProgressBarSchema(*, _target_: Literal['pytorch_lightning.callbacks.TQDMProgressBar', 'pytorch_lightning.callbacks.RichProgressBar', 'anemoi.training.diagnostics.profilers.ProfilerProgressBar'], refresh_rate: Annotated[int, Gt(gt=0)] = 1)

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_: Literal['pytorch_lightning.callbacks.TQDMProgressBar', 'pytorch_lightning.callbacks.RichProgressBar', 'anemoi.training.diagnostics.profilers.ProfilerProgressBar']

TQDMProgressBar object from pytorch lightning.

refresh_rate: Annotated[int, Gt(gt=0)]

Refresh rate of the progress bar.

class anemoi.training.schemas.diagnostics.DiagnosticsSchema(*, plot: PlotSchema | None = None, callbacks: list = <factory>, benchmark_profiler: BenchmarkProfilerSchema, debug: Debug, log: LoggingSchema, enable_progress_bar: bool, progress_bar: ProgressBarSchema | None = None, print_memory_summary: bool, enable_checkpointing: bool, checkpoint: CheckpointSchema = <factory>, check_val_every_n_epoch: Annotated[int, ~annotated_types.Gt(gt=0)] = 1)

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

plot: PlotSchema | None

Plot schema.

callbacks: list

Callbacks schema.

benchmark_profiler: BenchmarkProfilerSchema

Benchmark profiler schema for profile command.

debug: Debug

Debug schema.

log: LoggingSchema

Log schema.

enable_progress_bar: bool

Activate progress bar.

progress_bar: ProgressBarSchema | None

Progress bar schema.

print_memory_summary: bool

Print the memory summary.

enable_checkpointing: bool

Allow model to save checkpoints.

checkpoint: CheckpointSchema

save frequencies (every_n_minutes, every_n_epochs, …) and exclude_hyperparameters.

Type:

Checkpoint settings

check_val_every_n_epoch: Annotated[int, Gt(gt=0)]

Run validation every n epochs.

System

class anemoi.training.schemas.system.HardwareSchema(*, accelerator: Annotated[str, ~pydantic.functional_validators.AfterValidator(func=functools.partial(<function allowed_values at 0x701a23e774c0>, values=['cpu', 'gpu', 'auto', 'cuda', 'tpu']))]='cuda', num_gpus_per_node: Annotated[int, ~annotated_types.Ge(ge=0)] = 1, num_nodes: Annotated[int, ~annotated_types.Ge(ge=0)] = 1, num_gpus_per_model: Annotated[int, ~annotated_types.Ge(ge=0)] = 1, num_gpus_per_ensemble: Annotated[int, ~annotated_types.Ge(ge=0)] = 1)

Bases: BaseModel

accelerator: partial(<function allowed_values at 0x701a23e774c0>, values=['cpu', 'gpu', 'auto', 'cuda', 'tpu']))]

Accelerator to use for training.

num_gpus_per_node: Annotated[int, Ge(ge=0)]

Number of GPUs per node.

num_nodes: Annotated[int, Ge(ge=0)]

Number of nodes.

num_gpus_per_model: Annotated[int, Ge(ge=0)]

Number of GPUs per model.

num_gpus_per_ensemble: Annotated[int, Ge(ge=0)]

Number of GPUs per ensemble.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.system.InputSchema(*, dataset: Path | dict[str, Path] | None = None, graph: Path | None = None, truncation: Path | None = None, truncation_inv: Path | None = None, loss_matrices_path: Path | None = None)

Bases: BaseModel

dataset: Path | dict[str, Path] | None

Path to the dataset file.

graph: Path | None

Path to the graph file.

truncation: Path | None

Path to the truncation matrix file.

truncation_inv: Path | None

Path to the inverse truncation matrix file.

loss_matrices_path: Path | None

Path to the directory containing smoothing matrices for the multiscale loss

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.system.CheckpointsSchema(*, root: Path, every_n_epochs: str = 'anemoi-by_epoch-epoch_{epoch:03d}-step_{step:06d}', every_n_train_steps: str = 'anemoi-by_step-epoch_{epoch:03d}-step_{step:06d}', every_n_minutes: str = 'anemoi-by_time-epoch_{epoch:03d}-step_{step:06d}')

Bases: BaseModel

root: Path

Root directory for saving checkpoint files.

every_n_epochs: str

File name pattern for checkpoint files saved by epoch frequency.

every_n_train_steps: str

File name pattern for checkpoint files saved by step frequency.

every_n_minutes: str

File name pattern for checkpoint files saved by time frequency (minutes).

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.system.Logs(*, root: Path, wandb: Path | None = None, mlflow: Path | None = None, tensorboard: Path | None = None)

Bases: BaseModel

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

wandb: Path | None

Path to output wandb logs.

mlflow: Path | None

Path to output mlflow logs.

tensorboard: Path | None

Path to output tensorboard logs.

class anemoi.training.schemas.system.OutputSchema(*, root: Path | None = None, logs: Logs | None = None, checkpoints: CheckpointsSchema = <factory>, plots: Path | None = None, profiler: Path | None)

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

root: Path | None

Path to the output directory.

logs: Logs | None

Logging directories.

checkpoints: CheckpointsSchema

Paths to the checkpoints.

plots: Path | None

Path to the plots directory.

profiler: Path | None

Path to the profiler directory.

class anemoi.training.schemas.system.SystemSchema(*, hardware: HardwareSchema, input: InputSchema, output: OutputSchema)

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

hardware: HardwareSchema

Specification of hardware and compute resources available including the number of nodes, GPUs, and accelerator.

input: InputSchema

Definitions of specific input and output artifacts used relative to the directories defined in output.

output: OutputSchema

High-level directory structure describing where data is read from.

Graph

class anemoi.graphs.schemas.base_graph.NodeSchema(*, node_builder: AnemoiDatasetNodeSchema | NPZnodeSchema | TextNodeSchema | ICONMeshNodeSchema | LimitedAreaNPZFileNodesSchema | ReducedGaussianGridNodeSchema | IcosahedralandHealPixNodeSchema | HealPixNodeSchema | LimitedAreaIcosahedralandHealPixNodeSchema | StretchedIcosahdralNodeSchema, attributes: dict[str, PlanarAreaWeightSchema | MaskedPlanarAreaWeightsSchema | SphericalAreaWeightSchema | CutOutMaskSchema | GridsMaskSchema | NonmissingAnemoiDatasetVariableSchema | BooleanOperationSchema] | None = None)

Bases: BaseModel

node_builder: Annotated[AnemoiDatasetNodeSchema | NPZnodeSchema | TextNodeSchema | ICONMeshNodeSchema | LimitedAreaNPZFileNodesSchema | ReducedGaussianGridNodeSchema | IcosahedralandHealPixNodeSchema | HealPixNodeSchema | LimitedAreaIcosahedralandHealPixNodeSchema | StretchedIcosahdralNodeSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]

Node builder schema.

attributes: dict[str, PlanarAreaWeightSchema | MaskedPlanarAreaWeightsSchema | SphericalAreaWeightSchema | CutOutMaskSchema | GridsMaskSchema | NonmissingAnemoiDatasetVariableSchema | BooleanOperationSchema] | None

Dictionary of attributes with names as keys and anemoi.graphs.nodes.attributes objects as values.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.graphs.schemas.base_graph.EdgeSchema(*, source_name: str, target_name: str, edge_builders: list[Annotated[KNNEdgeSchema | MutualKNNEdgeSchema | CutoffEdgeSchema | MultiScaleEdgeSchema | HEALPixMultiScaleEdgesSchema | ICONTopologicalEdgeSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]], attributes: dict[str, BaseEdgeAttributeSchema | EdgeAttributeFromNodeSchema | DirectionalHarmonicsSchema | RadialBasisFeaturesSchema])

Bases: BaseModel

source_name: str

Source of the edges.

target_name: str

Target of the edges.

edge_builders: list[Annotated[KNNEdgeSchema | MutualKNNEdgeSchema | CutoffEdgeSchema | MultiScaleEdgeSchema | HEALPixMultiScaleEdgesSchema | ICONTopologicalEdgeSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]]

Edge builder schema.

attributes: dict[str, BaseEdgeAttributeSchema | EdgeAttributeFromNodeSchema | DirectionalHarmonicsSchema | RadialBasisFeaturesSchema]

Dictionary of attributes with names as keys and anemoi.graphs.edges.attributes objects as values.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.graphs.schemas.base_graph.BaseGraphSchema(*, nodes: dict[str, ~anemoi.graphs.schemas.base_graph.NodeSchema] | None=None, edges: list[EdgeSchema] | None = None, overwrite: bool, post_processors: list[~types.Annotated[~anemoi.graphs.schemas.post_processors.RemoveUnconnectedNodesSchema | ~anemoi.graphs.schemas.post_processors.SubsetNodesInAreaSchema | ~anemoi.graphs.schemas.post_processors.RestrictEdgeLengthSchema | ~anemoi.graphs.schemas.post_processors.RemoveSelfEdgesSchema | ~anemoi.graphs.schemas.post_processors.SortEdgeIndexSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]] = <factory>)

Bases: BaseModel

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

nodes: dict[str, NodeSchema] | None

Nodes schema for all types of nodes (ex. data, hidden).

edges: list[EdgeSchema] | None

List of edges schema.

overwrite: bool

whether to overwrite existing graph file. Default to True.

Model

class anemoi.models.schemas.models.DefinedModels(value)

Bases: str, Enum

class anemoi.models.schemas.models.Model(*, _target_: DefinedModels, hidden_nodes_name: str | list[str], latent_skip: bool = True, _convert_: str = 'none')

Bases: BaseModel

target_: DefinedModels

Model object defined in anemoi.models.model.

hidden_nodes_name: str | list[str]

Name of the hidden nodes. If the model is hierarchical, it can be a list of names for each level.

latent_skip: bool

Add skip connection in latent space before/after processor.

convert_: str

Keep OmegaConf containers when instantiating — model code uses attribute-style access throughout.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.models.schemas.models.SparseProjectorSchema(*, num_chunks: Annotated[int, Gt(gt=0)] = 1)

Bases: BaseModel

num_chunks: PositiveInt

Number of chunks to use for sparse projection matmuls.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.models.schemas.models.TransportSourceConfig(*, kind: Literal['default', 'zero', 'gaussian', 'reference_state'] = 'default', scale: Annotated[float, Ge(ge=0)] = 1.0, noise_scale: Annotated[float, Ge(ge=0)] = 0.0)

Bases: BaseModel

Configuration of the starting/source field for transport objectives.

The defaults map 1:1 to TransportSourceSettings in anemoi.models.transport.settings and are restated here so that importing the schemas does not pull in the model code.

kind: Literal['default', 'zero', 'gaussian', 'reference_state']

Starting field used before the transport objective moves toward the target.

scale: NonNegativeFloat

Multiplier applied to the starting/source field.

noise_scale: NonNegativeFloat

Additional additive Gaussian noise applied to the starting/source field.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.models.schemas.models.TransportConfig(*, objective: Literal['edm_diffusion', 'stochastic_interpolant']='edm_diffusion', sigma_data: Annotated[float, ~annotated_types.Gt(gt=0)] = 1.0, noise_channels: Annotated[int, ~annotated_types.Gt(gt=0)] = 32, noise_cond_dim: Annotated[int, ~annotated_types.Gt(gt=0)] = 16, sigma_max: Annotated[float, ~annotated_types.Gt(gt=0)] = 100.0, sigma_min: Annotated[float, ~annotated_types.Gt(gt=0)] = 0.02, rho: Annotated[float, ~annotated_types.Gt(gt=0)] = 7.0, si_alpha_schedule: Literal['linear'] = 'linear', si_beta_schedule: Literal['linear', 'quadratic']='linear', si_sigma_schedule: Literal['brownian_bridge', 'quadratic_bridge']='brownian_bridge', source: TransportSourceConfig = <factory>, si_noise_scale: Annotated[float, ~annotated_types.Ge(ge=0)] = 1.0, training_condition: dict = <factory>, noise_embedder: dict = <factory>, inference_defaults: dict = <factory>)

Bases: BaseModel

Configuration of the transport objective, path, conditioning and inference.

The defaults map 1:1 to EdmSettings, NoiseConditioningSettings and StochasticInterpolantSettings in anemoi.models.transport.settings and are restated here so that importing the schemas does not pull in the model code.

objective: Literal['edm_diffusion', 'stochastic_interpolant']

Training and sampling objective used by the transport model.

sigma_data: PositiveFloat

Typical data scale used by EDM diffusion.

noise_channels: PositiveInt

Number of channels in the noise or bridge-time embedding.

noise_cond_dim: PositiveInt

Size of the conditioning vector passed to conditional layers.

sigma_max: PositiveFloat

Maximum EDM diffusion noise level used during training.

sigma_min: PositiveFloat

Minimum EDM diffusion noise level used during training.

rho: PositiveFloat

Shape parameter for the Karras EDM noise schedule.

si_alpha_schedule: Literal['linear']

Schedule for how strongly the SI bridge keeps the source field.

si_beta_schedule: Literal['linear', 'quadratic']

Schedule for how strongly the SI bridge moves toward the target field.

si_sigma_schedule: Literal['brownian_bridge', 'quadratic_bridge']

Schedule for the SI bridge-noise amplitude.

source: TransportSourceConfig

Configuration for the starting/source field.

si_noise_scale: NonNegativeFloat

Overall scale of the stochastic-interpolant bridge noise.

training_condition: dict

Distribution used to sample one training noise level or bridge time per sample.

noise_embedder: dict

Hydra configuration for embedding the current noise level or bridge time.

inference_defaults: dict

Default sampler parameters used during inference.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.models.schemas.models.TransportModel(*, _target_: ~anemoi.models.schemas.models.DefinedModels, hidden_nodes_name: str | list[str], latent_skip: bool = True, _convert_: str = 'none', transport: ~anemoi.models.schemas.models.TransportConfig = <factory>)

Bases: Model

transport: TransportConfig

Transport model objective, path, conditioning, and inference configuration.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.models.schemas.models.NoOutputMaskSchema(*, _target_: Literal['anemoi.training.utils.masks.NoOutputMask'])

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.models.schemas.models.Boolean1DSchema(*, _target_: Literal['anemoi.training.utils.masks.Boolean1DMask'], attribute_name: str)

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.models.schemas.models.EncodersSchema(*, source_datasets: list[str], dataset_fusing_strategy: Literal['not_supported'] = 'not_supported', mapper: GNNEncoderSchema | GraphTransformerEncoderSchema | TransformerEncoderSchema | PointWiseForwardMapperSchema)

Bases: BaseModel

Encoder schema

source_datasets: list[str]

List of datasets for which the encoder is applicable.

dataset_fusing_strategy: Literal['not_supported']

Dataset fusing strategy. Default to ‘not_supported’.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.models.schemas.models.DecodersSchema(*, target_datasets: list[str], target_node_features: list[~typing.Literal['coordinates', 'encoded_data', 'forcings', 'prognostics', 'trainable_parameters']] = <factory>, mapper: ~anemoi.models.schemas.decoder.GNNDecoderSchema | ~anemoi.models.schemas.decoder.GraphTransformerDecoderSchema | ~anemoi.models.schemas.decoder.TransformerDecoderSchema | ~anemoi.models.schemas.decoder.PointWiseBackwardMapperSchema)

Bases: BaseModel

Decoder schema

target_datasets: list[str]

List of datasets for which the decoder is applicable.

target_node_features: list[Literal[tuple(sorted(VALID_TARGET_FEATURES))]]

Whether to use the encoded latents from the encoder.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.models.schemas.models.BaseModelSchema(*, keep_batch_sharded: bool = True, sparse_projector: ~anemoi.models.schemas.models.SparseProjectorSchema = <factory>, model: ~anemoi.models.schemas.models.Model = <factory>, node_trainable_parameters: dict[str, ~typing.Annotated[int, ~annotated_types.Ge(ge=0)]], bounding: dict[~typing.Literal['datasets'], dict[str, list[~typing.Annotated[~anemoi.models.schemas.bounding.ReluBoundingSchema | ~anemoi.models.schemas.bounding.LeakyReluBoundingSchema | ~anemoi.models.schemas.bounding.FractionBoundingSchema | ~anemoi.models.schemas.bounding.LeakyFractionBoundingSchema | ~anemoi.models.schemas.bounding.HardtanhBoundingSchema | ~anemoi.models.schemas.bounding.LeakyHardtanhBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedReluBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedLeakyReluBoundingSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]]]] | list[~typing.Annotated[~anemoi.models.schemas.bounding.ReluBoundingSchema | ~anemoi.models.schemas.bounding.LeakyReluBoundingSchema | ~anemoi.models.schemas.bounding.FractionBoundingSchema | ~anemoi.models.schemas.bounding.LeakyFractionBoundingSchema | ~anemoi.models.schemas.bounding.HardtanhBoundingSchema | ~anemoi.models.schemas.bounding.LeakyHardtanhBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedReluBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedLeakyReluBoundingSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]], output_mask: dict[~typing.Literal['datasets'], dict[str, ~anemoi.models.schemas.models.NoOutputMaskSchema | ~anemoi.models.schemas.models.Boolean1DSchema]] | ~anemoi.models.schemas.models.NoOutputMaskSchema | ~anemoi.models.schemas.models.Boolean1DSchema, latent_skip: bool = True, latent_aggregator: ~anemoi.models.schemas.aggregator.SumAggregatorSchema | ~anemoi.models.schemas.aggregator.MeanAggregatorSchema | ~anemoi.models.schemas.aggregator.ConcatAggregatorSchema | ~anemoi.models.schemas.aggregator.PointwiseCrossAttentionAggregatorSchema, processor: ~anemoi.models.schemas.processor.NoOpProcessorSchema | ~anemoi.models.schemas.processor.GNNProcessorSchema | ~anemoi.models.schemas.processor.GraphTransformerProcessorSchema | ~anemoi.models.schemas.processor.TransformerProcessorSchema | ~anemoi.models.schemas.processor.PointWiseMLPProcessorSchema, encoders: dict[str, ~anemoi.models.schemas.models.EncodersSchema], decoders: dict[str, ~anemoi.models.schemas.models.DecodersSchema], residual: dict[~typing.Literal['datasets'], dict[str, ~types.Annotated[~anemoi.models.schemas.residual.SkipConnectionSchema | ~anemoi.models.schemas.residual.TruncatedConnectionSchema | ~anemoi.models.schemas.residual.ScalarOrnsteinConnectionSchema | ~anemoi.models.schemas.residual.SpectralOrnsteinConnectionSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]]] | ~types.Annotated[~anemoi.models.schemas.residual.SkipConnectionSchema | ~anemoi.models.schemas.residual.TruncatedConnectionSchema | ~anemoi.models.schemas.residual.ScalarOrnsteinConnectionSchema | ~anemoi.models.schemas.residual.SpectralOrnsteinConnectionSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')], compile: list[dict[str, ~typing.Any]] | None = None, recompile_limit: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 8)

Bases: BaseModel

keep_batch_sharded: bool

Keep the input batch and the output of the model sharded

sparse_projector: SparseProjectorSchema

Sparse projection settings.

model: Model

Model schema.

node_trainable_parameters: dict[str, NonNegativeInt]

Learnable node and edge parameters.

bounding: DatasetDict[list[BoundingSchema]]

List of bounding configuration applied in order to the specified variables.

output_mask: DatasetDict[OutputMaskSchemas]

Output mask

latent_skip: bool

Add skip connection in latent space before/after processor.

latent_aggregator: AggregatorSchema

Latent aggregator schema.

processor: NoOpProcessorSchema | GNNProcessorSchema | GraphTransformerProcessorSchema | TransformerProcessorSchema | PointWiseMLPProcessorSchema

Model processor schema.

encoders: dict[str, EncodersSchema]

Model encoders schemas.

decoders: dict[str, DecodersSchema]

Model decoders schemas.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

residual: DatasetDict[ResidualConnectionSchema]

Residual connection schema.

compile: list[dict[str, Any]] | None

Modules to be compiled

recompile_limit: PositiveInt

How many times torch.compile will recompile a function for a given input shape.

classmethod cast_encoder_decoder_keys_to_str(data: Any) → Any

Cast encoder/decoder dict keys to str (YAML may parse them as int).

class anemoi.models.schemas.models.NoOpNoiseInjectorSchema(*, _target_: Literal['anemoi.models.layers.ensemble.NoOpNoiseInjector'])

Bases: BaseModel

Schema for NoOpNoiseInjector - passes input through unchanged.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_: Literal['anemoi.models.layers.ensemble.NoOpNoiseInjector']

No-op noise injector class

class anemoi.models.schemas.models.NoiseConditioningSchema(*, _target_: ~typing.Literal['anemoi.models.layers.ensemble.NoiseConditioning'], noise_std: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)], noise_channels_dim: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)], noise_mlp_hidden_dim: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)], layer_kernels: dict[str, dict] | None = <factory>, noise_matrix: str | None = None, noise_edges_name: tuple[str, str, str] | None = None, edge_weight_attribute: str | None = None, row_normalize_noise_matrix: bool = False, autocast: bool = False)

Bases: BaseModel

Schema for NoiseConditioning - generates noise for conditioning.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_: Literal['anemoi.models.layers.ensemble.NoiseConditioning']

Noise conditioning layer class

noise_std: NonNegativeInt

Standard deviation of the noise to be injected.

noise_channels_dim: NonNegativeInt

Number of channels in the noise tensor.

noise_mlp_hidden_dim: NonNegativeInt

Hidden dimension of the MLP used to process the noise.

layer_kernels: dict[str, dict] | None

Settings related to custom kernels for encoder processor and decoder blocks

noise_matrix: str | None

Path to the noise projection matrix file (.npz). If None, no projection is applied.

noise_edges_name: tuple[str, str, str] | None

Edge type identifier (src, relation, dst) for graph-based noise projection.

edge_weight_attribute: str | None

Optional edge attribute name for graph-based noise projection weights.

row_normalize_noise_matrix: bool

Whether to row-normalize the noise projection matrix weights.

autocast: bool

Whether to use autocast for the noise projection matrix operations.

class anemoi.models.schemas.models.NoiseInjectorSchema(*, _target_: ~typing.Literal['anemoi.models.layers.ensemble.NoiseInjector'], noise_std: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)], noise_channels_dim: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)], noise_mlp_hidden_dim: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)], layer_kernels: dict[str, dict] | None = <factory>)

Bases: BaseModel

Schema for NoiseInjector - injects noise directly into input tensor.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_: Literal['anemoi.models.layers.ensemble.NoiseInjector']

Noise injector layer class

noise_std: NonNegativeInt

Standard deviation of the noise to be injected.

noise_channels_dim: NonNegativeInt

Number of channels in the noise tensor.

noise_mlp_hidden_dim: NonNegativeInt

Hidden dimension of the MLP used to process the noise.

layer_kernels: dict[str, dict] | None

Settings related to custom kernels for encoder processor and decoder blocks

class anemoi.models.schemas.models.EnsModelSchema(*, keep_batch_sharded: bool = True, sparse_projector: ~anemoi.models.schemas.models.SparseProjectorSchema = <factory>, model: ~anemoi.models.schemas.models.Model = <factory>, node_trainable_parameters: dict[str, ~typing.Annotated[int, ~annotated_types.Ge(ge=0)]], bounding: dict[~typing.Literal['datasets'], dict[str, list[~typing.Annotated[~anemoi.models.schemas.bounding.ReluBoundingSchema | ~anemoi.models.schemas.bounding.LeakyReluBoundingSchema | ~anemoi.models.schemas.bounding.FractionBoundingSchema | ~anemoi.models.schemas.bounding.LeakyFractionBoundingSchema | ~anemoi.models.schemas.bounding.HardtanhBoundingSchema | ~anemoi.models.schemas.bounding.LeakyHardtanhBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedReluBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedLeakyReluBoundingSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]]]] | list[~typing.Annotated[~anemoi.models.schemas.bounding.ReluBoundingSchema | ~anemoi.models.schemas.bounding.LeakyReluBoundingSchema | ~anemoi.models.schemas.bounding.FractionBoundingSchema | ~anemoi.models.schemas.bounding.LeakyFractionBoundingSchema | ~anemoi.models.schemas.bounding.HardtanhBoundingSchema | ~anemoi.models.schemas.bounding.LeakyHardtanhBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedReluBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedLeakyReluBoundingSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]], output_mask: dict[~typing.Literal['datasets'], dict[str, ~anemoi.models.schemas.models.NoOutputMaskSchema | ~anemoi.models.schemas.models.Boolean1DSchema]] | ~anemoi.models.schemas.models.NoOutputMaskSchema | ~anemoi.models.schemas.models.Boolean1DSchema, latent_skip: bool = True, latent_aggregator: ~anemoi.models.schemas.aggregator.SumAggregatorSchema | ~anemoi.models.schemas.aggregator.MeanAggregatorSchema | ~anemoi.models.schemas.aggregator.ConcatAggregatorSchema | ~anemoi.models.schemas.aggregator.PointwiseCrossAttentionAggregatorSchema, processor: ~anemoi.models.schemas.processor.NoOpProcessorSchema | ~anemoi.models.schemas.processor.GNNProcessorSchema | ~anemoi.models.schemas.processor.GraphTransformerProcessorSchema | ~anemoi.models.schemas.processor.TransformerProcessorSchema | ~anemoi.models.schemas.processor.PointWiseMLPProcessorSchema, encoders: dict[str, ~anemoi.models.schemas.models.EncodersSchema], decoders: dict[str, ~anemoi.models.schemas.models.DecodersSchema], residual: dict[~typing.Literal['datasets'], dict[str, ~types.Annotated[~anemoi.models.schemas.residual.SkipConnectionSchema | ~anemoi.models.schemas.residual.TruncatedConnectionSchema | ~anemoi.models.schemas.residual.ScalarOrnsteinConnectionSchema | ~anemoi.models.schemas.residual.SpectralOrnsteinConnectionSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]]] | ~types.Annotated[~anemoi.models.schemas.residual.SkipConnectionSchema | ~anemoi.models.schemas.residual.TruncatedConnectionSchema | ~anemoi.models.schemas.residual.ScalarOrnsteinConnectionSchema | ~anemoi.models.schemas.residual.SpectralOrnsteinConnectionSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')], compile: list[dict[str, ~typing.Any]] | None = None, recompile_limit: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 8, noise_injector: ~anemoi.models.schemas.models.NoOpNoiseInjectorSchema | ~anemoi.models.schemas.models.NoiseConditioningSchema | ~anemoi.models.schemas.models.NoiseInjectorSchema, condition_on_residual: bool = False)

Bases: BaseModelSchema

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

noise_injector: NoiseInjectorUnion

Noise injection configuration. Use NoOpNoiseInjector to disable, NoiseConditioning for conditioning, or NoiseInjector for direct injection.

condition_on_residual: bool

Whether to condition the noise injection on the residual connection.

class anemoi.models.schemas.models.TransportModelSchema(*, keep_batch_sharded: bool = True, sparse_projector: ~anemoi.models.schemas.models.SparseProjectorSchema = <factory>, model: ~anemoi.models.schemas.models.TransportModel = <factory>, node_trainable_parameters: dict[str, ~typing.Annotated[int, ~annotated_types.Ge(ge=0)]], bounding: dict[~typing.Literal['datasets'], dict[str, list[~typing.Annotated[~anemoi.models.schemas.bounding.ReluBoundingSchema | ~anemoi.models.schemas.bounding.LeakyReluBoundingSchema | ~anemoi.models.schemas.bounding.FractionBoundingSchema | ~anemoi.models.schemas.bounding.LeakyFractionBoundingSchema | ~anemoi.models.schemas.bounding.HardtanhBoundingSchema | ~anemoi.models.schemas.bounding.LeakyHardtanhBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedReluBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedLeakyReluBoundingSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]]]] | list[~typing.Annotated[~anemoi.models.schemas.bounding.ReluBoundingSchema | ~anemoi.models.schemas.bounding.LeakyReluBoundingSchema | ~anemoi.models.schemas.bounding.FractionBoundingSchema | ~anemoi.models.schemas.bounding.LeakyFractionBoundingSchema | ~anemoi.models.schemas.bounding.HardtanhBoundingSchema | ~anemoi.models.schemas.bounding.LeakyHardtanhBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedReluBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedLeakyReluBoundingSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]], output_mask: dict[~typing.Literal['datasets'], dict[str, ~anemoi.models.schemas.models.NoOutputMaskSchema | ~anemoi.models.schemas.models.Boolean1DSchema]] | ~anemoi.models.schemas.models.NoOutputMaskSchema | ~anemoi.models.schemas.models.Boolean1DSchema, latent_skip: bool = True, latent_aggregator: ~anemoi.models.schemas.aggregator.SumAggregatorSchema | ~anemoi.models.schemas.aggregator.MeanAggregatorSchema | ~anemoi.models.schemas.aggregator.ConcatAggregatorSchema | ~anemoi.models.schemas.aggregator.PointwiseCrossAttentionAggregatorSchema, processor: ~anemoi.models.schemas.processor.NoOpProcessorSchema | ~anemoi.models.schemas.processor.GNNProcessorSchema | ~anemoi.models.schemas.processor.GraphTransformerProcessorSchema | ~anemoi.models.schemas.processor.TransformerProcessorSchema | ~anemoi.models.schemas.processor.PointWiseMLPProcessorSchema, encoders: dict[str, ~anemoi.models.schemas.models.EncodersSchema], decoders: dict[str, ~anemoi.models.schemas.models.DecodersSchema], residual: dict[~typing.Literal['datasets'], dict[str, ~types.Annotated[~anemoi.models.schemas.residual.SkipConnectionSchema | ~anemoi.models.schemas.residual.TruncatedConnectionSchema | ~anemoi.models.schemas.residual.ScalarOrnsteinConnectionSchema | ~anemoi.models.schemas.residual.SpectralOrnsteinConnectionSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]]] | ~types.Annotated[~anemoi.models.schemas.residual.SkipConnectionSchema | ~anemoi.models.schemas.residual.TruncatedConnectionSchema | ~anemoi.models.schemas.residual.ScalarOrnsteinConnectionSchema | ~anemoi.models.schemas.residual.SpectralOrnsteinConnectionSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')], compile: list[dict[str, ~typing.Any]] | None = None, recompile_limit: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 8)

Bases: BaseModelSchema

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model: TransportModel

Transport model schema.

class anemoi.models.schemas.models.TransportTendModelSchema(*, keep_batch_sharded: bool = True, sparse_projector: ~anemoi.models.schemas.models.SparseProjectorSchema = <factory>, model: ~anemoi.models.schemas.models.TransportModel = <factory>, node_trainable_parameters: dict[str, ~typing.Annotated[int, ~annotated_types.Ge(ge=0)]], bounding: dict[~typing.Literal['datasets'], dict[str, list[~typing.Annotated[~anemoi.models.schemas.bounding.ReluBoundingSchema | ~anemoi.models.schemas.bounding.LeakyReluBoundingSchema | ~anemoi.models.schemas.bounding.FractionBoundingSchema | ~anemoi.models.schemas.bounding.LeakyFractionBoundingSchema | ~anemoi.models.schemas.bounding.HardtanhBoundingSchema | ~anemoi.models.schemas.bounding.LeakyHardtanhBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedReluBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedLeakyReluBoundingSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]]]] | list[~typing.Annotated[~anemoi.models.schemas.bounding.ReluBoundingSchema | ~anemoi.models.schemas.bounding.LeakyReluBoundingSchema | ~anemoi.models.schemas.bounding.FractionBoundingSchema | ~anemoi.models.schemas.bounding.LeakyFractionBoundingSchema | ~anemoi.models.schemas.bounding.HardtanhBoundingSchema | ~anemoi.models.schemas.bounding.LeakyHardtanhBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedReluBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedLeakyReluBoundingSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]], output_mask: dict[~typing.Literal['datasets'], dict[str, ~anemoi.models.schemas.models.NoOutputMaskSchema | ~anemoi.models.schemas.models.Boolean1DSchema]] | ~anemoi.models.schemas.models.NoOutputMaskSchema | ~anemoi.models.schemas.models.Boolean1DSchema, latent_skip: bool = True, latent_aggregator: ~anemoi.models.schemas.aggregator.SumAggregatorSchema | ~anemoi.models.schemas.aggregator.MeanAggregatorSchema | ~anemoi.models.schemas.aggregator.ConcatAggregatorSchema | ~anemoi.models.schemas.aggregator.PointwiseCrossAttentionAggregatorSchema, processor: ~anemoi.models.schemas.processor.NoOpProcessorSchema | ~anemoi.models.schemas.processor.GNNProcessorSchema | ~anemoi.models.schemas.processor.GraphTransformerProcessorSchema | ~anemoi.models.schemas.processor.TransformerProcessorSchema | ~anemoi.models.schemas.processor.PointWiseMLPProcessorSchema, encoders: dict[str, ~anemoi.models.schemas.models.EncodersSchema], decoders: dict[str, ~anemoi.models.schemas.models.DecodersSchema], residual: dict[~typing.Literal['datasets'], dict[str, ~types.Annotated[~anemoi.models.schemas.residual.SkipConnectionSchema | ~anemoi.models.schemas.residual.TruncatedConnectionSchema | ~anemoi.models.schemas.residual.ScalarOrnsteinConnectionSchema | ~anemoi.models.schemas.residual.SpectralOrnsteinConnectionSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]]] | ~types.Annotated[~anemoi.models.schemas.residual.SkipConnectionSchema | ~anemoi.models.schemas.residual.TruncatedConnectionSchema | ~anemoi.models.schemas.residual.ScalarOrnsteinConnectionSchema | ~anemoi.models.schemas.residual.SpectralOrnsteinConnectionSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')], compile: list[dict[str, ~typing.Any]] | None = None, recompile_limit: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 8, condition_on_residual: bool = False)

Bases: TransportModelSchema

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

condition_on_residual: bool

Whether to condition the noise injection on the residual connection.

class anemoi.models.schemas.models.HierarchicalModelSchema(*, keep_batch_sharded: bool = True, sparse_projector: ~anemoi.models.schemas.models.SparseProjectorSchema = <factory>, model: ~anemoi.models.schemas.models.Model = <factory>, node_trainable_parameters: dict[str, ~typing.Annotated[int, ~annotated_types.Ge(ge=0)]], bounding: dict[~typing.Literal['datasets'], dict[str, list[~typing.Annotated[~anemoi.models.schemas.bounding.ReluBoundingSchema | ~anemoi.models.schemas.bounding.LeakyReluBoundingSchema | ~anemoi.models.schemas.bounding.FractionBoundingSchema | ~anemoi.models.schemas.bounding.LeakyFractionBoundingSchema | ~anemoi.models.schemas.bounding.HardtanhBoundingSchema | ~anemoi.models.schemas.bounding.LeakyHardtanhBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedReluBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedLeakyReluBoundingSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]]]] | list[~typing.Annotated[~anemoi.models.schemas.bounding.ReluBoundingSchema | ~anemoi.models.schemas.bounding.LeakyReluBoundingSchema | ~anemoi.models.schemas.bounding.FractionBoundingSchema | ~anemoi.models.schemas.bounding.LeakyFractionBoundingSchema | ~anemoi.models.schemas.bounding.HardtanhBoundingSchema | ~anemoi.models.schemas.bounding.LeakyHardtanhBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedReluBoundingSchema | ~anemoi.models.schemas.bounding.NormalizedLeakyReluBoundingSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]], output_mask: dict[~typing.Literal['datasets'], dict[str, ~anemoi.models.schemas.models.NoOutputMaskSchema | ~anemoi.models.schemas.models.Boolean1DSchema]] | ~anemoi.models.schemas.models.NoOutputMaskSchema | ~anemoi.models.schemas.models.Boolean1DSchema, latent_skip: bool = True, latent_aggregator: ~anemoi.models.schemas.aggregator.SumAggregatorSchema | ~anemoi.models.schemas.aggregator.MeanAggregatorSchema | ~anemoi.models.schemas.aggregator.ConcatAggregatorSchema | ~anemoi.models.schemas.aggregator.PointwiseCrossAttentionAggregatorSchema, processor: ~anemoi.models.schemas.processor.NoOpProcessorSchema | ~anemoi.models.schemas.processor.GNNProcessorSchema | ~anemoi.models.schemas.processor.GraphTransformerProcessorSchema | ~anemoi.models.schemas.processor.TransformerProcessorSchema | ~anemoi.models.schemas.processor.PointWiseMLPProcessorSchema, encoders: dict[str, ~anemoi.models.schemas.models.EncodersSchema], decoders: dict[str, ~anemoi.models.schemas.models.DecodersSchema], residual: dict[~typing.Literal['datasets'], dict[str, ~types.Annotated[~anemoi.models.schemas.residual.SkipConnectionSchema | ~anemoi.models.schemas.residual.TruncatedConnectionSchema | ~anemoi.models.schemas.residual.ScalarOrnsteinConnectionSchema | ~anemoi.models.schemas.residual.SpectralOrnsteinConnectionSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')]]] | ~types.Annotated[~anemoi.models.schemas.residual.SkipConnectionSchema | ~anemoi.models.schemas.residual.TruncatedConnectionSchema | ~anemoi.models.schemas.residual.ScalarOrnsteinConnectionSchema | ~anemoi.models.schemas.residual.SpectralOrnsteinConnectionSchema, FieldInfo(annotation=NoneType, required=True, discriminator='target_')], compile: list[dict[str, ~typing.Any]] | None = None, recompile_limit: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 8, enable_hierarchical_level_processing: bool = False, level_process_num_layers: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)] = 1, upscale_mapper: ~anemoi.models.schemas.encoder.GNNEncoderSchema | ~anemoi.models.schemas.encoder.GraphTransformerEncoderSchema | ~anemoi.models.schemas.encoder.TransformerEncoderSchema | ~anemoi.models.schemas.encoder.PointWiseForwardMapperSchema, downscale_mapper: ~anemoi.models.schemas.decoder.GNNDecoderSchema | ~anemoi.models.schemas.decoder.GraphTransformerDecoderSchema | ~anemoi.models.schemas.decoder.TransformerDecoderSchema | ~anemoi.models.schemas.decoder.PointWiseBackwardMapperSchema)

Bases: BaseModelSchema

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

enable_hierarchical_level_processing: bool

Toggle to do message passing at every downscaling and upscaling step

level_process_num_layers: NonNegativeInt

Number of message passing steps at each level

upscale_mapper: GNNEncoderSchema | GraphTransformerEncoderSchema | TransformerEncoderSchema | PointWiseForwardMapperSchema

Mapper used to upscale from a lower level to a higher level in the hierarchy.

downscale_mapper: GNNDecoderSchema | GraphTransformerDecoderSchema | TransformerDecoderSchema | PointWiseBackwardMapperSchema

Mapper used to downscale from a higher level to a lower level in the hierarchy.

classmethod default_num_channels_in_hierarchical_mapper(data: Any) → Any

Allow num_channels to be omitted.

It will be set at model build time.

Training

class anemoi.training.schemas.training.GenericSchema(*, _target_: str, **extra_data: Any)

Bases: BaseModel

Generic Hydra instantiation schema with a required _target_ and arbitrary extra fields.

model_config = {'extra': 'allow', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_: str

Hydra target class or function to instantiate.

class anemoi.training.schemas.training.OptimizerSchema(*, _target_: str, **extra_data: Any)

Bases: GenericSchema

Hydra instantiation config for a PyTorch optimizer.

model_config = {'extra': 'allow', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.LRSchedulerSchema(*, _target_: str, **extra_data: Any)

Bases: GenericSchema

Hydra instantiation config for a learning rate scheduler.

model_config = {'extra': 'allow', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.PLSchedulerSchema(*, interval: str = 'step', **extra_data: Any)

Bases: BaseModel

PyTorch Lightning LRSchedulerConfig wrapper fields (interval, monitor, etc.).

model_config = {'extra': 'allow', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

interval: str

Interval at which Lightning calls lr_scheduler_step (‘step’ or ‘epoch’). Defaults to ‘step’.

class anemoi.training.schemas.training.GradientClip(*, val: float = 32.0, algorithm: ~typing.Annotated[str, ~pydantic.functional_validators.AfterValidator(func=functools.partial(<function allowed_values at 0x701a23e774c0>, values=['value', 'norm']))])

Bases: BaseModel

Gradient clipping configuration.

val: float

Gradient clipping value.

algorithm: partial(<function allowed_values at 0x701a23e774c0>, values=['value', 'norm']))]

The gradient clipping algorithm to use

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.WeightAveragingSchema(*, _target_: str, **extra_data: Any)

Bases: GenericSchema

Hydra instantiation config for a weight averaging callback (EMA or SWA).

Example

weight_averaging:

_target_: anemoi.training.diagnostics.callbacks.weight_averaging.EMAWeightAveraging decay: 0.999 update_starting_at_step: 1000

Stock pytorch_lightning.callbacks.*WeightAveraging classes can also be used. Set use_buffers=False when the model contains non-floating-point buffers.

model_config = {'extra': 'allow', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.OptimizationSchema(*, lr: ~typing.Annotated[float, ~annotated_types.Ge(ge=0)], optimizer: ~anemoi.training.schemas.training.OptimizerSchema, lr_scheduler: ~anemoi.training.schemas.training.LRSchedulerSchema | None = None, pl_lr_scheduler: ~anemoi.training.schemas.training.PLSchedulerSchema = <factory>)

Bases: BaseModel

Optimizer and LR scheduler configuration.

lr: Annotated[float, Ge(ge=0)]

Base learning rate per GPU. Scaled by hardware config at runtime.

optimizer: OptimizerSchema

Hydra instantiation config for the optimizer.

lr_scheduler: LRSchedulerSchema | None

Hydra instantiation config for the LR scheduler. If None, no scheduler is used.

pl_lr_scheduler: PLSchedulerSchema

PyTorch Lightning LRSchedulerConfig wrapper fields (interval, monitor, etc.).

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.ExplicitTimes(*, input: list[Annotated[int, Ge(ge=0)]], target: list[Annotated[int, Ge(ge=0)]])

Bases: BaseModel

Time indices for input and output.

Starts at index 0. Input and output can overlap.

input: list[Annotated[int, Ge(ge=0)]]

Input time indices.

target: list[Annotated[int, Ge(ge=0)]]

Target time indices.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.TargetForcing(*, data: list[str], time_fraction: bool)

Bases: BaseModel

Forcing parameters for target output times.

Extra forcing parameters to use as input to distinguish between different target times.

data: list[str]

List of forcing parameters to use as input to the model at the interpolated step.

time_fraction: bool

Use target time as a fraction between input boundary times as input.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.LossScalingSchema(*, default: int = 1, pl: dict[str, Annotated[float, Ge(ge=0)]], sfc: dict[str, Annotated[float, Ge(ge=0)]])

Bases: BaseModel

default: int

Default scaling value applied to the variables loss. Default to 1.

pl: dict[str, Annotated[float, Ge(ge=0)]]

Scaling value associated to each pressure level variable loss.

sfc: dict[str, Annotated[float, Ge(ge=0)]]

Scaling value associated to each surface variable loss.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.GeneralVariableLossScalerSchema(*, _target_: Literal['anemoi.training.losses.scalers.GeneralVariableLossScaler'], weights: dict[str, float])

Bases: BaseModel

weights: dict[str, float]

Weight of each variable.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.VariableMaskingScalerSchema(*, _target_: Literal['anemoi.training.losses.scalers.VariableMaskingLossScaler'], variables: list[str], invert: bool)

Bases: BaseModel

variables: list[str]

Variables to compute the loss over.

invert: bool

Flag to invert the variable mask.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.NaNMaskScalerSchema(*, _target_: Literal['anemoi.training.losses.scalers.NaNMaskScaler'], use_processors_tendencies: bool = False)

Bases: BaseModel

use_processors_tendencies: bool

Flag to include processors for tendencies when building the loss mask.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.TendencyScalerTargets(value)

Bases: StrEnum

class anemoi.training.schemas.training.TendencyScalerSchema(*, _target_: TendencyScalerTargets, timestep: str | None = None)

Bases: BaseModel

timestep: str | None

Timestep key used to select tendency statistics for scalers.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.VariableLevelScalerTargets(value)

Bases: StrEnum

class anemoi.training.schemas.training.VariableLevelScalerSchema(*, _target_: VariableLevelScalerTargets, group: str, slope: float, y_intercept: float)

Bases: BaseModel

group: str

Group of variables to scale.

slope: float

Slope of scaling function.

y_intercept: float

Y-axis shift of scaling function.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.GraphNodeAttributeScalerSchema(*, _target_: Literal['anemoi.training.losses.scalers.GraphNodeAttributeScaler'], nodes_attribute_name: str, norm: Literal['unit-max', 'unit-sum'] | None)

Bases: BaseModel

nodes_attribute_name: str

Name of the node attribute to return.

norm: Literal['unit-max', 'unit-sum'] | None

Normalisation method applied to the node attribute.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.TimeStepScalerSchema(*, _target_: Literal['anemoi.training.losses.scalers.TimeStepScaler'], norm: Literal['unit-max', 'unit-sum'] | None = 'unit-sum', weights: list[float])

Bases: BaseModel

norm: Literal['unit-max', 'unit-sum'] | None

Normalisation method applied to the weights.

weights: list[float]

Weights for each time step.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.UniformTimeStepScalerSchema(*, _target_: Literal['anemoi.training.losses.scalers.UniformTimeStepScaler'])

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.LeadTimeDecayScalerSchema(*, _target_: Literal['anemoi.training.losses.scalers.LeadTimeDecayScaler'], output_lead_times: list[int], decay_factor: float, max_lead_time: int, decay_type: Literal['linear', 'exponential'] | None = 'linear', inverse: bool | None = False, norm: Literal['unit-max', 'unit-sum'] | None = 'unit-sum')

Bases: BaseModel

output_lead_times: list[int]

Lead times corresponding to each output step.

decay_factor: float

Decay factor for the lead time weights.

max_lead_time: int

Maximum lead time for decay calculation.

decay_type: Literal['linear', 'exponential'] | None

Type of decay to apply.

inverse: bool | None

If true, weights increase with lead time.

norm: Literal['unit-max', 'unit-sum'] | None

Normalisation method applied to the weights.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.ReweightedGraphNodeAttributeScalerSchema(*, _target_: Literal['anemoi.training.losses.scalers.ReweightedGraphNodeAttributeScaler'], nodes_attribute_name: str, scaling_mask_attribute_name: str, weight_frac_of_total: float, norm: Literal['unit-max', 'unit-sum'] | None)

Bases: BaseModel

nodes_attribute_name: str

Name of the node attribute to return.

scaling_mask_attribute_name: str

Name of the node attribute to use as a mask to reweight the reference values.

weight_frac_of_total: float

Fraction of total weight to assign to nodes within the scaling mask. The remaining weight is distributed among

norm: Literal['unit-max', 'unit-sum'] | None

Normalisation method applied to the node attribute.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.SpectralDimensionScalerSchema(*, _target_: Literal['anemoi.training.losses.scalers.SpectralDimensionScaler'], n_spectral_modes: Annotated[int, Gt(gt=0)], spectral_dims: Annotated[int, Gt(gt=0)] | None = None, norm: Literal['unit-sum', 'unit-mean', 'l1'] | None = None)

Bases: BaseModel

n_spectral_modes: Annotated[int, Gt(gt=0)]

Number of total wavenumbers (L dimension). For SHT-based losses this is truncation + 1.

spectral_dims: Annotated[int, Gt(gt=0)] | None

Length of the spectral dimension as seen by the loss. Defaults to n_spectral_modes.

norm: Literal['unit-sum', 'unit-mean', 'l1'] | None

Normalisation method applied to the scaler values.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.ImplementedLossesUsingBaseLossSchema(value)

Bases: StrEnum

class anemoi.training.schemas.training.CheckVariablesCompatibilitySchema(*, ignore_units: bool | list[str] = False, ignore_processing_period: bool | list[str] = False, ignore_time_processing: bool | list[str] = False, ignore_type_of_level: bool | list[str] = False)

Bases: BaseModel

Options forwarded to Variable.check_compatibility / Variable.compatible.

Each field may be set to True to skip the check for all variables, or to a list of variable names to skip only those specific variables.

ignore_units: bool | list[str]

Ignore unit mismatches. True skips all unit checks; a list of variable names skips only those variables.

ignore_processing_period: bool | list[str]

Ignore accumulation-period mismatches. True skips all period checks; a list of variable names skips only those variables.

ignore_time_processing: bool | list[str]

Ignore time-processing type mismatches. True skips all time-processing checks; a list of variable names skips only those variables.

ignore_type_of_level: bool | list[str]

Ignore mismatches in pressure level status. True skips all type-of-level checks; a list of variable names skips only those variables.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.BaseLossSchema(*, _target_: ~anemoi.training.schemas.training.ImplementedLossesUsingBaseLossSchema, scalers: list[str], ignore_nans: bool = False, predicted_variables: list[str] | None = None, target_variables: list[str] | None = None, check_variables_compatibility: ~anemoi.training.schemas.training.CheckVariablesCompatibilitySchema = <factory>)

Bases: BaseModel

target_: ImplementedLossesUsingBaseLossSchema

Loss function object from anemoi.training.losses.

scalers: list[str]

Scalers to include in loss calculation

ignore_nans: bool

Allow nans in the loss and apply methods ignoring nans for measuring the loss.

check_variables_compatibility: CheckVariablesCompatibilitySchema

Options forwarded to Variable.check_compatibility when checking predicted vs. target variable units.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.CRPSSchema(*, _target_: ~anemoi.training.schemas.training.ImplementedLossesUsingBaseLossSchema, scalers: list[str], ignore_nans: bool = False, predicted_variables: list[str] | None = None, target_variables: list[str] | None = None, check_variables_compatibility: ~anemoi.training.schemas.training.CheckVariablesCompatibilitySchema = <factory>, alpha: ~typing.Annotated[float, ~annotated_types.Ge(ge=0.0), ~annotated_types.Le(le=1.0)] = 0.95, backend: ~typing.Literal['naive', 'stable'] = 'stable', no_autocast: bool = True)

Bases: BaseLossSchema

alpha: float

Factor for linear combination of fair CRPS and standard CRPS. Values between 0 and 1 give the almost fair CRPS formulation.

backend: Literal['naive', 'stable']

Backend used for the point-wise CRPS calculation.

no_autocast: bool

Deactivate autocast for the kernel CRPS calculation

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.GraphLossMatrixSchema(*, edges_name: tuple[str, str, str], edge_weight_attribute: str | None = None, src_node_weight_attribute: str | None = None, row_normalize: bool = False)

Bases: BaseModel

One graph-backed smoothing matrix definition for multiscale loss.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.GraphScoreGraphSchema(*, edges_name: tuple[str, str, str], edge_weight_attribute: str | None = None, src_node_weight_attribute: str | None = None, row_normalize: bool = False, validate_row_sums: bool = False)

Bases: BaseModel

Graph edge definition used by graph score losses.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.EnsembleScoreLossSchema(*, scalers: list[str] = <factory>, ignore_nans: bool = False, predicted_variables: list[str] | None = None, target_variables: list[str] | None = None, check_variables_compatibility: CheckVariablesCompatibilitySchema = <factory>, no_autocast: bool = True)

Bases: BaseModel

Configuration shared by ensemble score losses.

model_config = {'extra': 'forbid', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.GraphScoreLossSchema(*, scalers: list[str] = <factory>, ignore_nans: bool = False, predicted_variables: list[str] | None = None, target_variables: list[str] | None = None, check_variables_compatibility: CheckVariablesCompatibilitySchema = <factory>, no_autocast: bool = True)

Bases: EnsembleScoreLossSchema

Configuration shared by graph score losses.

model_config = {'extra': 'forbid', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.GraphEnergyScoreLossSchema(*, scalers: list[str] = <factory>, ignore_nans: bool = False, predicted_variables: list[str] | None = None, target_variables: list[str] | None = None, check_variables_compatibility: ~anemoi.training.schemas.training.CheckVariablesCompatibilitySchema = <factory>, no_autocast: bool = True, _target_: ~typing.Literal['anemoi.training.losses.GraphEnergyScoreLoss'], fair: bool = True, loss_graph: ~anemoi.training.schemas.training.GraphScoreGraphSchema | None = None)

Bases: GraphScoreLossSchema

model_config = {'extra': 'forbid', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.EnergyScoreLossSchema(*, scalers: list[str] = <factory>, ignore_nans: bool = False, predicted_variables: list[str] | None = None, target_variables: list[str] | None = None, check_variables_compatibility: ~anemoi.training.schemas.training.CheckVariablesCompatibilitySchema = <factory>, no_autocast: bool = True, _target_: ~typing.Literal['anemoi.training.losses.EnergyScoreLoss'], fair: bool = True, norm_over: ~typing.Annotated[list[~typing.Literal['time', 'grid', 'variables']], ~annotated_types.MinLen(min_length=1)] = ['grid'])

Bases: EnsembleScoreLossSchema

model_config = {'extra': 'forbid', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.GraphVariogramScoreLossSchema(*, scalers: list[str] = <factory>, ignore_nans: bool = False, predicted_variables: list[str] | None = None, target_variables: list[str] | None = None, check_variables_compatibility: ~anemoi.training.schemas.training.CheckVariablesCompatibilitySchema = <factory>, no_autocast: bool = True, _target_: ~typing.Literal['anemoi.training.losses.GraphVariogramScoreLoss'], loss_graph: ~anemoi.training.schemas.training.GraphScoreGraphSchema, p: ~typing.Annotated[float, ~annotated_types.Gt(gt=0)] = 1.0, fair: bool = True)

Bases: GraphScoreLossSchema

model_config = {'extra': 'forbid', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.GraphEdgeCRPSLossSchema(*, scalers: list[str] = <factory>, ignore_nans: bool = False, predicted_variables: list[str] | None = None, target_variables: list[str] | None = None, check_variables_compatibility: ~anemoi.training.schemas.training.CheckVariablesCompatibilitySchema = <factory>, no_autocast: bool = True, _target_: ~typing.Literal['anemoi.training.losses.GraphEdgeCRPSLoss'], loss_graph: ~anemoi.training.schemas.training.GraphScoreGraphSchema, alpha: ~typing.Annotated[float, ~annotated_types.Ge(ge=0.0), ~annotated_types.Le(le=1.0)] = 1.0)

Bases: GraphScoreLossSchema

model_config = {'extra': 'forbid', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema(*, scalers: list[str] = <factory>, ignore_nans: bool = False, predicted_variables: list[str] | None = None, target_variables: list[str] | None = None, check_variables_compatibility: ~anemoi.training.schemas.training.CheckVariablesCompatibilitySchema = <factory>, no_autocast: bool = True, _target_: ~typing.Literal['anemoi.training.losses.GraphEdgeEnergyScoreLoss'], loss_graph: ~anemoi.training.schemas.training.GraphScoreGraphSchema, fair: bool = True)

Bases: GraphScoreLossSchema

model_config = {'extra': 'forbid', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.MultiscaleConfigDiskSchema(*, loss_matrices_path: str | None = None, loss_matrices: list[str | None], scalers: list[str] | None = None)

Bases: BaseModel

File-based multiscale config: smoothing matrices loaded from .npz files.

model_config = {'extra': 'forbid', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

scalers: list[str] | None

Scalers to apply to the wrapped loss (delegated to inner per_scale_loss).

class anemoi.training.schemas.training.MultiscaleConfigOnTheFlySchema(*, num_scales: int | None = None, base_num_nearest_neighbours: int | None = None, base_sigma: float | None = None, scale_factor: int | None = None, smoothers: dict[str, dict] | None = None)

Bases: BaseModel

On-the-fly multiscale config: smoothing subgraphs built from the main graph.

model_config = {'extra': 'forbid', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.TimeAggregateLossWrapperSchema(*, _target_: Literal['anemoi.training.losses.aggregate.TimeAggregateLossWrapper'], time_aggregation_types: Annotated[list[Literal['diff', 'mean', 'min', 'max']], MinLen(min_length=1)], loss_fn: BaseLossSchema | CRPSSchema, scalers: list[str] | None = None)

Bases: BaseModel

Schema for TimeAggregateLossWrapper used inside CombinedLoss.

time_aggregation_types: list[Literal['diff', 'mean', 'min', 'max']]

Time aggregation operations to apply over the time dimension before computing the loss.

loss_fn: BaseLossSchema | CRPSSchema

Inner loss function applied to each time-aggregated output.

scalers: list[str] | None

Scalers to apply to the wrapped loss (delegated to inner loss_fn).

classmethod add_empty_scalers_to_inner(v: Any) → Any

Inject empty scalers for inner loss if missing; scalers flow through the wrapper.

This is needed to avoid validation errors on the inner loss when scalers are only defined at the wrapper level.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.MultiScaleLossSchema(*, _target_: Literal['anemoi.training.losses.MultiscaleLossWrapper'], per_scale_loss: CRPSSchema | TimeAggregateLossWrapperSchema | GraphEnergyScoreLossSchema | EnergyScoreLossSchema | GraphVariogramScoreLossSchema | GraphEdgeCRPSLossSchema | GraphEdgeEnergyScoreLossSchema | BaseLossSchema, weights: list[float], multiscale_config: MultiscaleConfigDiskSchema | MultiscaleConfigOnTheFlySchema | None = None, sparse_projector_num_chunks: Annotated[int, Gt(gt=0)] = 1, loss_matrices_path: str | None = None, loss_matrices: list[str | None] | None = None)

Bases: BaseModel

classmethod add_empty_scalers_to_inner(v: Any) → Any

Inject empty scalers for inner loss if missing; scalers flow through the wrapper.

This is needed to avoid validation errors on the inner loss when scalers are only defined at the wrapper level.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.HuberLossSchema(*, _target_: ~anemoi.training.schemas.training.ImplementedLossesUsingBaseLossSchema, scalers: list[str], ignore_nans: bool = False, predicted_variables: list[str] | None = None, target_variables: list[str] | None = None, check_variables_compatibility: ~anemoi.training.schemas.training.CheckVariablesCompatibilitySchema = <factory>, delta: float = 1.0)

Bases: BaseLossSchema

delta: float

Threshold for Huber loss.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.SpectralProjectionConfigSchema(*, matrix_path: str | None = None, edges_name: tuple[str, str, str] | None = None, num_nearest_neighbours: int | None = None, sigma: float | None = None, grid: str | None = None, node_builder: dict | None = None, target_node_name: str = 'target_grid', edge_weight_attribute: str | None = None, src_node_weight_attribute: str | None = None, row_normalize: bool = False)

Bases: BaseModel

Configuration for sparse projection applied before the spectral transform.

Exactly one mode must be configured:

  • File mode: provide matrix_path.

  • Edge mode: provide edges_name.

  • Target-grid mode: provide num_nearest_neighbours and sigma together with either grid or node_builder.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.SpectralLossSchema(*, _target_: ~anemoi.training.schemas.training.ImplementedLossesUsingBaseLossSchema, scalers: list[str], ignore_nans: bool = False, predicted_variables: list[str] | None = None, target_variables: list[str] | None = None, check_variables_compatibility: ~anemoi.training.schemas.training.CheckVariablesCompatibilitySchema = <factory>, transform: ~typing.Literal['fft2d', 'dct2d', 'regular_sht', 'reduced_sht', 'octahedral_sht'], subgrid: tuple[int, int | None] | ~typing.Literal['output_mask'] | None = None, projection_config: ~anemoi.training.schemas.training.SpectralProjectionConfigSchema | None = None, coefficient_magnitude: bool = False, **extra_data: ~typing.Any)

Bases: BaseLossSchema

Spectral loss class.

transform: Literal['fft2d', 'dct2d', 'regular_sht', 'reduced_sht', 'octahedral_sht']

Type of spectral transform to use.

subgrid: tuple[int, int | None] | Literal['output_mask'] | None

Optional slice or string to select a subgrid before the transform.

projection_config: SpectralProjectionConfigSchema | None

Optional sparse projection applied to the data before the spectral transform.

coefficient_magnitude: bool

For spectral CRPS, compare the moduli of the coefficients rather than their complex values.

class Config

Bases: Config

Override to allow extra parameters for spectral transforms.

model_config = {'extra': 'allow', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.CombinedLossSchema(*, _target_: ~typing.Literal['anemoi.training.losses.combined.CombinedLoss'], scalers: list[str] = <factory>, ignore_nans: bool = False, predicted_variables: list[str] | None = None, target_variables: list[str] | None = None, check_variables_compatibility: ~anemoi.training.schemas.training.CheckVariablesCompatibilitySchema = <factory>, losses: ~typing.Annotated[list[~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]], ~annotated_types.MinLen(min_length=1)], loss_weights: list[int | float] | None = None)

Bases: BaseLossSchema

Schema for CombinedLoss.

Top-level scalers act as defaults for sub-losses that don’t specify their own. Sub-losses that explicitly set scalers override the parent value.

model_config = {'extra': 'forbid', 'populate_by_name': True, 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_: Literal['anemoi.training.losses.combined.CombinedLoss']

CombinedLoss target.

scalers: list[str]

Optional top-level scalers propagated to sub-losses that don’t define their own.

losses: list[Annotated[Annotated[BaseLossSchema, Tag(tag=base)] | Annotated[HuberLossSchema, Tag(tag=huber)] | Annotated[CRPSSchema, Tag(tag=crps)] | Annotated[GraphEnergyScoreLossSchema, Tag(tag=graph_energy_score)] | Annotated[EnergyScoreLossSchema, Tag(tag=energy_score)] | Annotated[GraphVariogramScoreLossSchema, Tag(tag=graph_variogram_score)] | Annotated[GraphEdgeCRPSLossSchema, Tag(tag=graph_edge_crps)] | Annotated[GraphEdgeEnergyScoreLossSchema, Tag(tag=graph_edge_energy_score)] | Annotated[SpectralLossSchema, Tag(tag=spectral)] | Annotated[MultiScaleLossSchema, Tag(tag=multiscale)] | Annotated[TimeAggregateLossWrapperSchema, Tag(tag=time_aggregate)], Discriminator(discriminator=_loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]]

Losses to combine, can be any of the normal losses.

loss_weights: list[int | float] | None

Weightings of losses, if not set, all losses are weighted equally.

classmethod propagate_scalers_to_children(data: Any) → Any

Propagate parent scalers to sub-losses that don’t specify their own.

MultiscaleLossWrapper is skipped because it manages scalers via per_scale_loss.

check_length_of_weights_and_losses() → Self

Check that the number of losses and weights match, or if not set, skip.

class anemoi.training.schemas.training.ImplementedStrategiesUsingBaseDDPStrategySchema(value)

Bases: StrEnum

class anemoi.training.schemas.training.SingleDeviceStrategySchema(*, _target_: Literal['anemoi.training.distributed.single.SingleDeviceStrategy'], device: str = 'auto')

Bases: BaseModel

target_: Literal['anemoi.training.distributed.single.SingleDeviceStrategy']

Hydra target for the single device strategy.

device: str

Device to use for training.

model_config = {'extra': 'ignore', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class anemoi.training.schemas.training.BaseDDPStrategySchema(*, _target_: ImplementedStrategiesUsingBaseDDPStrategySchema, num_gpus_per_model: Annotated[int, Gt(gt=0)], read_group_size: Annotated[int, Gt(gt=0)], use_local_synchronization: bool = True, broadcast_buffers: bool = False, static_graph: bool = False, find_unused_parameters: bool = True)

Bases: BaseModel

Strategy configuration.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

num_gpus_per_model: Annotated[int, Gt(gt=0)]

Number of GPUs per model.

read_group_size: Annotated[int, Gt(gt=0)]

Number of GPUs per reader group. Defaults to number of GPUs.

use_local_synchronization: bool

Use synchronization local to the group when creating process groups.

broadcast_buffers: bool

Broadcast model buffers at the start of each iteration. Defaults to False.

static_graph: bool

Tell DDP that the same parameters are trained in every step. Can be faster for large models, but must be false when training.accum_grad_batches > 1.

find_unused_parameters: bool

false, DDP sums the gradients in the same groups in every step, so a resumed run continues bitwise identically.

Type:

Let DDP check every step for parameters that receive no gradient. Together with static_graph

class anemoi.training.schemas.training.DDPEnsGroupStrategyStrategySchema(*, _target_: ImplementedStrategiesUsingBaseDDPStrategySchema, num_gpus_per_model: Annotated[int, Gt(gt=0)], read_group_size: Annotated[int, Gt(gt=0)], use_local_synchronization: bool = True, broadcast_buffers: bool = False, static_graph: bool = False, find_unused_parameters: bool = True, num_gpus_per_ensemble: Annotated[int, Gt(gt=0)])

Bases: BaseDDPStrategySchema

Strategy object from anemoi.training.strategy.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

num_gpus_per_ensemble: Annotated[int, Gt(gt=0)]

Number of GPUs per ensemble.

class anemoi.training.schemas.training.UpdateDsStatsOnCkptLoadSchema(*, states: bool = False, tendencies: bool = True)

Bases: BaseModel

Configuration for updating processor statistics on checkpoint load.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

states: bool

Rebuild state pre/post-processing statistics from the current dataset.

tendencies: bool

Rebuild tendency pre/post-processing statistics from the current dataset.

class anemoi.training.schemas.training.CheckpointPipelineSchema(*, source: GenericSchema | None = None, loading: GenericSchema | None = None, modifiers: list[GenericSchema] | None = None)

Bases: BaseModel

Declarative checkpoint pipeline consumed by build_checkpoint_pipeline.

Each block is a Hydra _target_ config: at most one acquisition source and one loading strategy, plus an ordered list of modifiers applied after loading. A None field configures no checkpoint pipeline (a fresh run).

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

source: GenericSchema | None

Acquisition source stage (LocalSource / RunIdSource / S3Source / HTTPSource).

loading: GenericSchema | None

Loading strategy stage (WeightsOnlyLoader / TransferLearningLoader / WarmStartLoader / ColdStartLoader).

modifiers: list[GenericSchema] | None

Ordered model-modifier stages applied after loading (e.g. FreezingModifierStage).

class anemoi.training.schemas.training.BaseTrainingSchema(*, seed: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)] | None = None, check_variables_compatibility: ~anemoi.training.schemas.training.CheckVariablesCompatibilitySchema = <factory>, allow_variable_subset: bool = False, update_ds_stats_on_ckpt_load: ~anemoi.training.schemas.training.UpdateDsStatsOnCkptLoadSchema = <factory>, checkpoint: ~anemoi.training.schemas.training.CheckpointPipelineSchema | None = None, deterministic: bool = False, precision: str = '16-mixed', preferred_blas_backend: str | None = None, accum_grad_batches: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 1, num_sanity_val_steps: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)], gradient_clip: ~anemoi.training.schemas.training.GradientClip, strategy: ~anemoi.training.schemas.training.BaseDDPStrategySchema | ~anemoi.training.schemas.training.DDPEnsGroupStrategyStrategySchema | ~anemoi.training.schemas.training.SingleDeviceStrategySchema, training_loss: dict[~typing.Literal['datasets'], dict[str, ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]]] | ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)], weight_averaging: ~anemoi.training.schemas.training.WeightAveragingSchema | None = None, loss_gradient_scaling: bool = False, scalers: dict[~typing.Literal['datasets'], dict[str, dict[str, ~anemoi.training.schemas.training.GeneralVariableLossScalerSchema | ~anemoi.training.schemas.training.VariableLevelScalerSchema | ~anemoi.training.schemas.training.VariableMaskingScalerSchema | ~anemoi.training.schemas.training.TendencyScalerSchema | ~anemoi.training.schemas.training.NaNMaskScalerSchema | ~anemoi.training.schemas.training.GraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.TimeStepScalerSchema | ~anemoi.training.schemas.training.UniformTimeStepScalerSchema | ~anemoi.training.schemas.training.LeadTimeDecayScalerSchema | ~anemoi.training.schemas.training.ReweightedGraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.SpectralDimensionScalerSchema]]] | dict[str, ~anemoi.training.schemas.training.GeneralVariableLossScalerSchema | ~anemoi.training.schemas.training.VariableLevelScalerSchema | ~anemoi.training.schemas.training.VariableMaskingScalerSchema | ~anemoi.training.schemas.training.TendencyScalerSchema | ~anemoi.training.schemas.training.NaNMaskScalerSchema | ~anemoi.training.schemas.training.GraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.TimeStepScalerSchema | ~anemoi.training.schemas.training.UniformTimeStepScalerSchema | ~anemoi.training.schemas.training.LeadTimeDecayScalerSchema | ~anemoi.training.schemas.training.ReweightedGraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.SpectralDimensionScalerSchema], validation_metrics: dict[~typing.Literal['datasets'], dict[str, dict[str, ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]] | None]] | dict[str, ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]] | None, variable_groups: dict[~typing.Literal['datasets'], dict[str, dict[str, str | list[str] | dict[str, str | bool | list[str | int]]] | None]] | dict[str, str | list[str] | dict[str, str | bool | list[str | int]]] | None, max_epochs: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] | None = None, max_steps: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 150000, optimization: ~anemoi.training.schemas.training.OptimizationSchema, metrics: dict[~typing.Literal['datasets'], dict[str, list[str]]] | list[str], ensemble_size_per_device: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 1)

Bases: BaseModel

Training configuration.

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

seed: Annotated[int, Ge(ge=0)] | None

Base seed of all random number generators. If null, a run continuing from a checkpoint takes the checkpoint’s seed and a new run draws one. A seed that differs from the checkpoint’s changes the rest of the interrupted epoch.

check_variables_compatibility: CheckVariablesCompatibilitySchema

Options forwarded to Variable.check_compatibility when checking checkpoint vs. current dataset (fine-tuning).

allow_variable_subset: bool

Allow fine-tuning into a model with FEWER variables (issue #838). When True, a checkpoint

update_ds_stats_on_ckpt_load: UpdateDsStatsOnCkptLoadSchema

Rebuild pre/post-processing statistics from the current dataset when loading a checkpoint.

checkpoint: CheckpointPipelineSchema | None

an

Type:

Checkpoint pipeline configuration consumed by build_checkpoint_pipeline

deterministic: bool

This flag sets torch.backends.cudnn.deterministic. It may reduce nondeterminism, but does not guarantee exact

precision: str

Precision

preferred_blas_backend: str | None

Optionally override PyTorch’s default BLAS backend.

accum_grad_batches: Annotated[int, Gt(gt=0)]

Accumulates gradients over k batches before stepping the optimizer. K >= 1 (if K == 1 then no accumulation). The effective bacthsize becomes num-device * k.

num_sanity_val_steps: Annotated[int, Ge(ge=0)]

Sanity check runs n batches of val before starting the training routine.

gradient_clip: GradientClip

Config for gradient clipping.

strategy: BaseDDPStrategySchema | DDPEnsGroupStrategyStrategySchema | SingleDeviceStrategySchema

Strategy to use.

training_loss: dict[Literal['datasets'], dict[str, Annotated[Annotated[BaseLossSchema, Tag(tag=base)] | Annotated[HuberLossSchema, Tag(tag=huber)] | Annotated[CombinedLossSchema, Tag(tag=combined)] | Annotated[CRPSSchema, Tag(tag=crps)] | Annotated[GraphEnergyScoreLossSchema, Tag(tag=graph_energy_score)] | Annotated[EnergyScoreLossSchema, Tag(tag=energy_score)] | Annotated[GraphVariogramScoreLossSchema, Tag(tag=graph_variogram_score)] | Annotated[GraphEdgeCRPSLossSchema, Tag(tag=graph_edge_crps)] | Annotated[GraphEdgeEnergyScoreLossSchema, Tag(tag=graph_edge_energy_score)] | Annotated[SpectralLossSchema, Tag(tag=spectral)] | Annotated[TimeAggregateLossWrapperSchema, Tag(tag=time_aggregate)] | Annotated[MultiScaleLossSchema, Tag(tag=multiscale)], Discriminator(discriminator=_loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]]] | Annotated[Annotated[BaseLossSchema, Tag(tag=base)] | Annotated[HuberLossSchema, Tag(tag=huber)] | Annotated[CombinedLossSchema, Tag(tag=combined)] | Annotated[CRPSSchema, Tag(tag=crps)] | Annotated[GraphEnergyScoreLossSchema, Tag(tag=graph_energy_score)] | Annotated[EnergyScoreLossSchema, Tag(tag=energy_score)] | Annotated[GraphVariogramScoreLossSchema, Tag(tag=graph_variogram_score)] | Annotated[GraphEdgeCRPSLossSchema, Tag(tag=graph_edge_crps)] | Annotated[GraphEdgeEnergyScoreLossSchema, Tag(tag=graph_edge_energy_score)] | Annotated[SpectralLossSchema, Tag(tag=spectral)] | Annotated[TimeAggregateLossWrapperSchema, Tag(tag=time_aggregate)] | Annotated[MultiScaleLossSchema, Tag(tag=multiscale)], Discriminator(discriminator=_loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]

Training loss configuration.

weight_averaging: WeightAveragingSchema | None

Config for weight averaging (SWA or EMA). Set to null to disable.

loss_gradient_scaling: bool

Dynamic rescaling of the loss gradient. Not yet tested.

scalers: dict[Literal['datasets'], dict[str, dict[str, GeneralVariableLossScalerSchema | VariableLevelScalerSchema | VariableMaskingScalerSchema | TendencyScalerSchema | NaNMaskScalerSchema | GraphNodeAttributeScalerSchema | TimeStepScalerSchema | UniformTimeStepScalerSchema | LeadTimeDecayScalerSchema | ReweightedGraphNodeAttributeScalerSchema | SpectralDimensionScalerSchema]]] | dict[str, GeneralVariableLossScalerSchema | VariableLevelScalerSchema | VariableMaskingScalerSchema | TendencyScalerSchema | NaNMaskScalerSchema | GraphNodeAttributeScalerSchema | TimeStepScalerSchema | UniformTimeStepScalerSchema | LeadTimeDecayScalerSchema | ReweightedGraphNodeAttributeScalerSchema | SpectralDimensionScalerSchema]

Scalers to use in the computation of the loss and validation scores.

validation_metrics: dict[Literal['datasets'], dict[str, dict[str, Annotated[Annotated[BaseLossSchema, Tag(tag=base)] | Annotated[HuberLossSchema, Tag(tag=huber)] | Annotated[CombinedLossSchema, Tag(tag=combined)] | Annotated[CRPSSchema, Tag(tag=crps)] | Annotated[GraphEnergyScoreLossSchema, Tag(tag=graph_energy_score)] | Annotated[EnergyScoreLossSchema, Tag(tag=energy_score)] | Annotated[GraphVariogramScoreLossSchema, Tag(tag=graph_variogram_score)] | Annotated[GraphEdgeCRPSLossSchema, Tag(tag=graph_edge_crps)] | Annotated[GraphEdgeEnergyScoreLossSchema, Tag(tag=graph_edge_energy_score)] | Annotated[SpectralLossSchema, Tag(tag=spectral)] | Annotated[TimeAggregateLossWrapperSchema, Tag(tag=time_aggregate)] | Annotated[MultiScaleLossSchema, Tag(tag=multiscale)], Discriminator(discriminator=_loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]] | None]] | dict[str, Annotated[Annotated[BaseLossSchema, Tag(tag=base)] | Annotated[HuberLossSchema, Tag(tag=huber)] | Annotated[CombinedLossSchema, Tag(tag=combined)] | Annotated[CRPSSchema, Tag(tag=crps)] | Annotated[GraphEnergyScoreLossSchema, Tag(tag=graph_energy_score)] | Annotated[EnergyScoreLossSchema, Tag(tag=energy_score)] | Annotated[GraphVariogramScoreLossSchema, Tag(tag=graph_variogram_score)] | Annotated[GraphEdgeCRPSLossSchema, Tag(tag=graph_edge_crps)] | Annotated[GraphEdgeEnergyScoreLossSchema, Tag(tag=graph_edge_energy_score)] | Annotated[SpectralLossSchema, Tag(tag=spectral)] | Annotated[TimeAggregateLossWrapperSchema, Tag(tag=time_aggregate)] | Annotated[MultiScaleLossSchema, Tag(tag=multiscale)], Discriminator(discriminator=_loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]] | None

List of validation metrics configurations.

variable_groups: dict[Literal['datasets'], dict[str, dict[str, str | list[str] | dict[str, str | bool | list[str | int]]] | None]] | dict[str, str | list[str] | dict[str, str | bool | list[str | int]]] | None

Groups for variable loss scaling

max_epochs: Annotated[int, Gt(gt=0)] | None

Maximum number of epochs, stops earlier if max_steps is reached first.

max_steps: Annotated[int, Gt(gt=0)]

Maximum number of steps, stops earlier if max_epochs is reached first.

optimization: OptimizationSchema

Optimizer and LR scheduler configuration.

metrics: dict[Literal['datasets'], dict[str, list[str]]] | list[str]

List of metrics

ensemble_size_per_device: Annotated[int, Gt(gt=0)]

Number of ensemble members per device. Default is 1 for non-ensemble forecasting.

check_static_graph_without_accumulation() → Self

DDP’s static graph does not support accumulating gradients over several batches.

class anemoi.training.schemas.training.SingleTrainingMethodSchema(*, _target_: Literal['anemoi.training.train.methods.SingleTraining'])

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_: Literal['anemoi.training.train.methods.SingleTraining']

Hydra target for the single training method.

class anemoi.training.schemas.training.EnsembleTrainingMethodSchema(*, _target_: Literal['anemoi.training.train.methods.EnsembleTraining'])

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_: Literal['anemoi.training.train.methods.EnsembleTraining']

Hydra target for the ensemble training method.

class anemoi.training.schemas.training.TransportTrainingMethodSchema(*, _target_: Literal['anemoi.training.train.methods.TransportTraining'])

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_: Literal['anemoi.training.train.methods.TransportTraining']

Hydra target for the transport training method.

class anemoi.training.schemas.training.SingleTrainingSchema(*, seed: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)] | None = None, check_variables_compatibility: ~anemoi.training.schemas.training.CheckVariablesCompatibilitySchema = <factory>, allow_variable_subset: bool = False, update_ds_stats_on_ckpt_load: ~anemoi.training.schemas.training.UpdateDsStatsOnCkptLoadSchema = <factory>, checkpoint: ~anemoi.training.schemas.training.CheckpointPipelineSchema | None = None, deterministic: bool = False, precision: str = '16-mixed', preferred_blas_backend: str | None = None, accum_grad_batches: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 1, num_sanity_val_steps: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)], gradient_clip: ~anemoi.training.schemas.training.GradientClip, strategy: ~anemoi.training.schemas.training.BaseDDPStrategySchema | ~anemoi.training.schemas.training.DDPEnsGroupStrategyStrategySchema | ~anemoi.training.schemas.training.SingleDeviceStrategySchema, training_loss: dict[~typing.Literal['datasets'], dict[str, ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]]] | ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)], weight_averaging: ~anemoi.training.schemas.training.WeightAveragingSchema | None = None, loss_gradient_scaling: bool = False, scalers: dict[~typing.Literal['datasets'], dict[str, dict[str, ~anemoi.training.schemas.training.GeneralVariableLossScalerSchema | ~anemoi.training.schemas.training.VariableLevelScalerSchema | ~anemoi.training.schemas.training.VariableMaskingScalerSchema | ~anemoi.training.schemas.training.TendencyScalerSchema | ~anemoi.training.schemas.training.NaNMaskScalerSchema | ~anemoi.training.schemas.training.GraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.TimeStepScalerSchema | ~anemoi.training.schemas.training.UniformTimeStepScalerSchema | ~anemoi.training.schemas.training.LeadTimeDecayScalerSchema | ~anemoi.training.schemas.training.ReweightedGraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.SpectralDimensionScalerSchema]]] | dict[str, ~anemoi.training.schemas.training.GeneralVariableLossScalerSchema | ~anemoi.training.schemas.training.VariableLevelScalerSchema | ~anemoi.training.schemas.training.VariableMaskingScalerSchema | ~anemoi.training.schemas.training.TendencyScalerSchema | ~anemoi.training.schemas.training.NaNMaskScalerSchema | ~anemoi.training.schemas.training.GraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.TimeStepScalerSchema | ~anemoi.training.schemas.training.UniformTimeStepScalerSchema | ~anemoi.training.schemas.training.LeadTimeDecayScalerSchema | ~anemoi.training.schemas.training.ReweightedGraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.SpectralDimensionScalerSchema], validation_metrics: dict[~typing.Literal['datasets'], dict[str, dict[str, ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]] | None]] | dict[str, ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]] | None, variable_groups: dict[~typing.Literal['datasets'], dict[str, dict[str, str | list[str] | dict[str, str | bool | list[str | int]]] | None]] | dict[str, str | list[str] | dict[str, str | bool | list[str | int]]] | None, max_epochs: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] | None = None, max_steps: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 150000, optimization: ~anemoi.training.schemas.training.OptimizationSchema, metrics: dict[~typing.Literal['datasets'], dict[str, list[str]]] | list[str], ensemble_size_per_device: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 1, method: ~anemoi.training.schemas.training.SingleTrainingMethodSchema)

Bases: BaseTrainingSchema

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

method: SingleTrainingMethodSchema

Training method.

class anemoi.training.schemas.training.EnsembleTrainingSchema(*, seed: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)] | None = None, check_variables_compatibility: ~anemoi.training.schemas.training.CheckVariablesCompatibilitySchema = <factory>, allow_variable_subset: bool = False, update_ds_stats_on_ckpt_load: ~anemoi.training.schemas.training.UpdateDsStatsOnCkptLoadSchema = <factory>, checkpoint: ~anemoi.training.schemas.training.CheckpointPipelineSchema | None = None, deterministic: bool = False, precision: str = '16-mixed', preferred_blas_backend: str | None = None, accum_grad_batches: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 1, num_sanity_val_steps: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)], gradient_clip: ~anemoi.training.schemas.training.GradientClip, strategy: ~anemoi.training.schemas.training.BaseDDPStrategySchema | ~anemoi.training.schemas.training.DDPEnsGroupStrategyStrategySchema | ~anemoi.training.schemas.training.SingleDeviceStrategySchema, training_loss: dict[~typing.Literal['datasets'], dict[str, ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]]] | ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)], weight_averaging: ~anemoi.training.schemas.training.WeightAveragingSchema | None = None, loss_gradient_scaling: bool = False, scalers: dict[~typing.Literal['datasets'], dict[str, dict[str, ~anemoi.training.schemas.training.GeneralVariableLossScalerSchema | ~anemoi.training.schemas.training.VariableLevelScalerSchema | ~anemoi.training.schemas.training.VariableMaskingScalerSchema | ~anemoi.training.schemas.training.TendencyScalerSchema | ~anemoi.training.schemas.training.NaNMaskScalerSchema | ~anemoi.training.schemas.training.GraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.TimeStepScalerSchema | ~anemoi.training.schemas.training.UniformTimeStepScalerSchema | ~anemoi.training.schemas.training.LeadTimeDecayScalerSchema | ~anemoi.training.schemas.training.ReweightedGraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.SpectralDimensionScalerSchema]]] | dict[str, ~anemoi.training.schemas.training.GeneralVariableLossScalerSchema | ~anemoi.training.schemas.training.VariableLevelScalerSchema | ~anemoi.training.schemas.training.VariableMaskingScalerSchema | ~anemoi.training.schemas.training.TendencyScalerSchema | ~anemoi.training.schemas.training.NaNMaskScalerSchema | ~anemoi.training.schemas.training.GraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.TimeStepScalerSchema | ~anemoi.training.schemas.training.UniformTimeStepScalerSchema | ~anemoi.training.schemas.training.LeadTimeDecayScalerSchema | ~anemoi.training.schemas.training.ReweightedGraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.SpectralDimensionScalerSchema], validation_metrics: dict[~typing.Literal['datasets'], dict[str, dict[str, ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]] | None]] | dict[str, ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]] | None, variable_groups: dict[~typing.Literal['datasets'], dict[str, dict[str, str | list[str] | dict[str, str | bool | list[str | int]]] | None]] | dict[str, str | list[str] | dict[str, str | bool | list[str | int]]] | None, max_epochs: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] | None = None, max_steps: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 150000, optimization: ~anemoi.training.schemas.training.OptimizationSchema, metrics: dict[~typing.Literal['datasets'], dict[str, list[str]]] | list[str], ensemble_size_per_device: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 1, method: ~anemoi.training.schemas.training.EnsembleTrainingMethodSchema)

Bases: BaseTrainingSchema

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

method: EnsembleTrainingMethodSchema

Training method.

class anemoi.training.schemas.training.TransportTrainingConfigSchema(*, prediction_mode: Literal['state', 'tendency'] = 'state', objective: Literal['edm_diffusion', 'stochastic_interpolant'] = 'edm_diffusion')

Bases: BaseModel

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

prediction_mode: Literal['state', 'tendency']

Endpoint semantics for the transport objective.

objective: Literal['edm_diffusion', 'stochastic_interpolant']

Transport objective used to perturb targets and train the model.

class anemoi.training.schemas.training.TransportTrainingSchema(*, seed: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)] | None = None, check_variables_compatibility: ~anemoi.training.schemas.training.CheckVariablesCompatibilitySchema = <factory>, allow_variable_subset: bool = False, update_ds_stats_on_ckpt_load: ~anemoi.training.schemas.training.UpdateDsStatsOnCkptLoadSchema = <factory>, checkpoint: ~anemoi.training.schemas.training.CheckpointPipelineSchema | None = None, deterministic: bool = False, precision: str = '16-mixed', preferred_blas_backend: str | None = None, accum_grad_batches: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 1, num_sanity_val_steps: ~typing.Annotated[int, ~annotated_types.Ge(ge=0)], gradient_clip: ~anemoi.training.schemas.training.GradientClip, strategy: ~anemoi.training.schemas.training.BaseDDPStrategySchema | ~anemoi.training.schemas.training.DDPEnsGroupStrategyStrategySchema | ~anemoi.training.schemas.training.SingleDeviceStrategySchema, training_loss: dict[~typing.Literal['datasets'], dict[str, ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]]] | ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)], weight_averaging: ~anemoi.training.schemas.training.WeightAveragingSchema | None = None, loss_gradient_scaling: bool = False, scalers: dict[~typing.Literal['datasets'], dict[str, dict[str, ~anemoi.training.schemas.training.GeneralVariableLossScalerSchema | ~anemoi.training.schemas.training.VariableLevelScalerSchema | ~anemoi.training.schemas.training.VariableMaskingScalerSchema | ~anemoi.training.schemas.training.TendencyScalerSchema | ~anemoi.training.schemas.training.NaNMaskScalerSchema | ~anemoi.training.schemas.training.GraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.TimeStepScalerSchema | ~anemoi.training.schemas.training.UniformTimeStepScalerSchema | ~anemoi.training.schemas.training.LeadTimeDecayScalerSchema | ~anemoi.training.schemas.training.ReweightedGraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.SpectralDimensionScalerSchema]]] | dict[str, ~anemoi.training.schemas.training.GeneralVariableLossScalerSchema | ~anemoi.training.schemas.training.VariableLevelScalerSchema | ~anemoi.training.schemas.training.VariableMaskingScalerSchema | ~anemoi.training.schemas.training.TendencyScalerSchema | ~anemoi.training.schemas.training.NaNMaskScalerSchema | ~anemoi.training.schemas.training.GraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.TimeStepScalerSchema | ~anemoi.training.schemas.training.UniformTimeStepScalerSchema | ~anemoi.training.schemas.training.LeadTimeDecayScalerSchema | ~anemoi.training.schemas.training.ReweightedGraphNodeAttributeScalerSchema | ~anemoi.training.schemas.training.SpectralDimensionScalerSchema], validation_metrics: dict[~typing.Literal['datasets'], dict[str, dict[str, ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]] | None]] | dict[str, ~typing.Annotated[~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.BaseLossSchema, ~pydantic.types.Tag(tag=base)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.HuberLossSchema, ~pydantic.types.Tag(tag=huber)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CombinedLossSchema, ~pydantic.types.Tag(tag=combined)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.CRPSSchema, ~pydantic.types.Tag(tag=crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.EnergyScoreLossSchema, ~pydantic.types.Tag(tag=energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphVariogramScoreLossSchema, ~pydantic.types.Tag(tag=graph_variogram_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeCRPSLossSchema, ~pydantic.types.Tag(tag=graph_edge_crps)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.GraphEdgeEnergyScoreLossSchema, ~pydantic.types.Tag(tag=graph_edge_energy_score)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.SpectralLossSchema, ~pydantic.types.Tag(tag=spectral)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.TimeAggregateLossWrapperSchema, ~pydantic.types.Tag(tag=time_aggregate)] | ~anemoi.training.schemas.training.Annotated[~anemoi.training.schemas.training.MultiScaleLossSchema, ~pydantic.types.Tag(tag=multiscale)], ~pydantic.types.Discriminator(discriminator=~anemoi.training.schemas.training._loss_discriminator, custom_error_type=None, custom_error_message=None, custom_error_context=None)]] | None, variable_groups: dict[~typing.Literal['datasets'], dict[str, dict[str, str | list[str] | dict[str, str | bool | list[str | int]]] | None]] | dict[str, str | list[str] | dict[str, str | bool | list[str | int]]] | None, max_epochs: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] | None = None, max_steps: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 150000, optimization: ~anemoi.training.schemas.training.OptimizationSchema, metrics: dict[~typing.Literal['datasets'], dict[str, list[str]]] | list[str], ensemble_size_per_device: ~typing.Annotated[int, ~annotated_types.Gt(gt=0)] = 1, method: ~anemoi.training.schemas.training.TransportTrainingMethodSchema, transport: ~anemoi.training.schemas.training.TransportTrainingConfigSchema = <factory>)

Bases: BaseTrainingSchema

model_config = {'extra': 'forbid', 'use_attribute_docstrings': True, 'use_enum_values': True, 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

method: TransportTrainingMethodSchema

Training method.

transport: TransportTrainingConfigSchema

Transport training configuration.