Skip to content

Commit

Permalink
Add unit test for config validation
Browse files Browse the repository at this point in the history
This unt test runner checks that all configs in configs/ are valid
  • Loading branch information
tnipen committed Feb 22, 2025
1 parent 783b233 commit 1938bcf
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
67 changes: 67 additions & 0 deletions config/working_example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
defaults:
- override hydra/job_logging: none
- override hydra/hydra_logging: none
- _self_

start_date: 2023-05-31T18:00:00
end_date: 2023-06-01T12:00:00 #2024-06-01T01:00:00

checkpoint_path: /pfs/lustrep4/scratch/project_465001383/aifs/experiments/reference/o96_pretrain/checkpoint/3fb85b72ba9647d5ae4fe86ce1b5a885/inference-last.ckpt

leadtimes: 12
timestep: 6h
frequency: 6h

deterministic: True

# If the user wants to release GPU cache and memory
# This option releases unused cached/memory used by torch
release_cache: False

dataloader:
batch_size: 1
prefetch_factor: 2
num_workers: 1
pin_memory: True

read_group_size: 1 #Do not change this, not implemented properly

predict:
dataset: ${dataset}
drop: ['cp', 'u_600', 'v_600', 'z_600', 't_600', 'q_600', 'w_600', 'longitude', 'latitude']
start: ${start_date}
end: ${end_date}
frequency: ${frequency}
reorder: ${reorder}

datamodule:
_target_: bris.data.dataset.NativeGridDataset #anemoi.training.data.dataset.ZipDataset
_convert_: all

hardware:
num_gpus_per_node: 8
num_gpus_per_model: 8
num_nodes: 1

dataset: aifs-od-an-oper-0001-mars-n320-2023-2024-6h-v2.zarr
workdir: test


model:
_target_: bris.model.BrisPredictor
_convert_: all

routing:
- decoder_index: 0
domain_index: 0
outputs:
- netcdf:
filename_pattern: /pfs/lustrep4/scratch/project_465001383/haugenha/anemoi-training-ref-updated/run-anemoi/lumi/predictions/n320_pred_%Y%m%dT%HZ.nc
variables: [2t, msl]
- verif:
filename: /pfs/lustrep4/scratch/project_465001383/haugenha/anemoi-training-ref-updated/run-anemoi/lumi/verif/2t/n320_at_ref.nc
variable: 2t
units: degC
obs_sources:
- verif:
filename: /pfs/lustrep4/scratch/project_465001383/aifs/old_project_misc/verification/202306_202405/t2m/AIFS_legendary_gnome_roll4.nc
16 changes: 16 additions & 0 deletions tests/test_configs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os

import bris.utils


def test_1():
filenames = ["working_example.yaml"]
for filename in filenames:
full_filename = (
os.path.dirname(os.path.abspath(__file__)) + "/../config/" + filename
)
bris.utils.validate(full_filename)


if __name__ == "__main__":
test_1()

0 comments on commit 1938bcf

Please sign in to comment.