From 83076beb95bdef662fc4ae0f12d676dee3464289 Mon Sep 17 00:00:00 2001 From: sp Date: Tue, 2 Jul 2024 11:09:11 +0200 Subject: [PATCH] enabled evaluation --- examples/shields/rl/13_minigridsb.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/shields/rl/13_minigridsb.py b/examples/shields/rl/13_minigridsb.py index 2170a9e..bc4eea2 100644 --- a/examples/shields/rl/13_minigridsb.py +++ b/examples/shields/rl/13_minigridsb.py @@ -69,8 +69,9 @@ def main(): # Evaluation - eval_freq=max(500, int(args.steps/30)) - n_eval_episodes=5 + #eval_freq=max(500, int(args.steps/30)) + eval_freq=10000 + n_eval_episodes=25 render_freq = eval_freq if shielded_evaluation(args.shielding): from sb3_contrib.common.maskable.evaluation import evaluate_policy @@ -86,7 +87,7 @@ def main(): imageAndVideoCallback = ImageRecorderCallback(eval_env, render_freq, n_eval_episodes=1, evaluation_method=evaluate_policy, log_dir=log_dir, deterministic=True, verbose=0) - model.learn(steps,callback=[imageAndVideoCallback, InfoCallback()]) + model.learn(steps,callback=[evalCallback, imageAndVideoCallback, InfoCallback()]) model.save(f"{log_dir}/{expname(args)}")