From 0830a2bae9b6f6f4b79d6dd42052d4e7c6f6bc57 Mon Sep 17 00:00:00 2001 From: Matteo Bettini <55539777+matteobettini@users.noreply.github.com> Date: Thu, 16 Nov 2023 13:27:58 +0000 Subject: [PATCH] [BugFix] Task loading schema validation (#37) --- benchmarl/environments/pettingzoo/simple_push.py | 1 - benchmarl/environments/pettingzoo/waterworld.py | 2 +- benchmarl/hydra_config.py | 6 ++++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/benchmarl/environments/pettingzoo/simple_push.py b/benchmarl/environments/pettingzoo/simple_push.py index bdee5e15..d2c37d56 100644 --- a/benchmarl/environments/pettingzoo/simple_push.py +++ b/benchmarl/environments/pettingzoo/simple_push.py @@ -11,4 +11,3 @@ class TaskConfig: task: str = MISSING max_cycles: int = MISSING - local_ratio: float = MISSING diff --git a/benchmarl/environments/pettingzoo/waterworld.py b/benchmarl/environments/pettingzoo/waterworld.py index ab81067c..16f310ee 100644 --- a/benchmarl/environments/pettingzoo/waterworld.py +++ b/benchmarl/environments/pettingzoo/waterworld.py @@ -26,7 +26,7 @@ class TaskConfig: poison_speed: float = MISSING poison_reward: float = MISSING food_reward: float = MISSING - encounter_rewar: float = MISSING + encounter_reward: float = MISSING thrust_penalty: float = MISSING local_ratio: float = MISSING speed_features: bool = MISSING diff --git a/benchmarl/hydra_config.py b/benchmarl/hydra_config.py index 20f27737..e1465e2a 100644 --- a/benchmarl/hydra_config.py +++ b/benchmarl/hydra_config.py @@ -32,7 +32,7 @@ def load_experiment_from_hydra(cfg: DictConfig, task_name: str) -> Experiment: def load_task_config_from_hydra(cfg: DictConfig, task_name: str) -> Task: return task_config_registry[task_name].update_config( - OmegaConf.to_container(cfg, resolve=True) + OmegaConf.to_container(cfg, resolve=True, throw_on_missing=True) ) @@ -56,5 +56,7 @@ def load_model_config_from_hydra(cfg: DictConfig) -> ModelConfig: else: model_class = model_config_registry[cfg.name] return model_class( - **parse_model_config(OmegaConf.to_container(cfg, resolve=True)) + **parse_model_config( + OmegaConf.to_container(cfg, resolve=True, throw_on_missing=True) + ) )