From 441d897e47819574e080d21d7c14f4690a9b3b89 Mon Sep 17 00:00:00 2001 From: Matteo Bettini Date: Tue, 7 Jan 2025 19:04:34 +0100 Subject: [PATCH] error --- benchmarl/models/common.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/benchmarl/models/common.py b/benchmarl/models/common.py index eb277d9f..d7976c2b 100644 --- a/benchmarl/models/common.py +++ b/benchmarl/models/common.py @@ -542,6 +542,10 @@ class EnsembleModelConfig(ModelConfig): model_configs_map: Dict[str, ModelConfig] def get_model(self, agent_group: str, **kwargs) -> Model: + if agent_group not in self.model_configs_map.keys(): + raise ValueError( + f"Environment contains agent group '{agent_group}' not present in the EnsembleModelConfig configuration." + ) return self.model_configs_map[agent_group].get_model( **kwargs, agent_group=agent_group )