Skip to content

Commit

Permalink
[Conf] Add render parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Bettini <[email protected]>
  • Loading branch information
matteobettini committed Oct 3, 2023
1 parent 3990fdc commit 3b2c93a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions benchmarl/conf/experiment/base_experiment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ off_policy_memory_size: 1_000_000
off_policy_train_batch_size: 15_000

evaluation: True
# Whether to render the evaluation (if rendering is available)
render: True
# Frequency of evaluation in terms of experiment iterations
evaluation_interval: 20
# Number of episodes that evaluation is run on
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/experiment/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class ExperimentConfig:
off_policy_train_batch_size: int = MISSING

evaluation: bool = MISSING
render: bool = MISSING
evaluation_interval: int = MISSING
evaluation_episodes: int = MISSING

Expand Down Expand Up @@ -483,7 +484,7 @@ def _grad_clip(self, optimizer: torch.optim.Optimizer) -> float:
def _evaluation_loop(self, iter: int):
evaluation_start = time.time()
with set_exploration_type(ExplorationType.MODE):
if self.task.has_render(self.test_env):
if self.task.has_render(self.test_env) and self.config.render:
frames = []

def callback(env, td):
Expand Down

0 comments on commit 3b2c93a

Please sign in to comment.