Skip to content

Commit

Permalink
Validation and Training dataset dates assertion (ecmwf#154)
Browse files Browse the repository at this point in the history
* Change training end date/validation start date assertion to a warning to allow flexibility.

Co-authored-by: Harrison Cook <Harrison.cook@ecmwf.int>

---------

Co-authored-by: Harrison Cook <Harrison.cook@ecmwf.int>
  • Loading branch information
gabrieloks and HCookie authored Nov 25, 2024
1 parent cf53a6e commit e3fe023
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/anemoi/training/data/datamodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ def ds_train(self) -> NativeGridDataset:
def ds_valid(self) -> NativeGridDataset:
r = max(self.rollout, self.config.dataloader.get("validation_rollout", 1))

assert self.config.dataloader.training.end < self.config.dataloader.validation.start, (
f"Training end date {self.config.dataloader.training.end} is not before"
f"validation start date {self.config.dataloader.validation.start}"
)
if not self.config.dataloader.training.end < self.config.dataloader.validation.start:
LOGGER.warning(
"Training end date %s is not before validation start date %s.",
self.config.dataloader.training.end,
self.config.dataloader.validation.start,
)
return self._get_dataset(
open_dataset(OmegaConf.to_container(self.config.dataloader.validation, resolve=True)),
shuffle=False,
Expand Down

0 comments on commit e3fe023

Please sign in to comment.