From 81f8c8ac78134ef789d66ff794a2614a6f0e140d Mon Sep 17 00:00:00 2001 From: Maximilian Ernestus Date: Thu, 30 Nov 2023 14:30:57 +0100 Subject: [PATCH] Fix warning in quickstart.py caused by not properly setting the render mode in the evaluation environment. --- examples/quickstart.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/quickstart.py b/examples/quickstart.py index 6acf9771d..e04660782 100644 --- a/examples/quickstart.py +++ b/examples/quickstart.py @@ -71,9 +71,16 @@ def sample_expert_transitions(): rng=rng, ) +evaluation_env = make_vec_env( + "seals:seals/CartPole-v0", + rng=rng, + env_make_kwargs={"render_mode": "human"}, # for rendering +) + +print("Evaluating the untrained policy.") reward, _ = evaluate_policy( bc_trainer.policy, # type: ignore[arg-type] - env, + evaluation_env, n_eval_episodes=3, render=True, # comment out to speed up ) @@ -82,9 +89,10 @@ def sample_expert_transitions(): print("Training a policy using Behavior Cloning") bc_trainer.train(n_epochs=1) +print("Evaluating the trained policy.") reward, _ = evaluate_policy( bc_trainer.policy, # type: ignore[arg-type] - env, + evaluation_env, n_eval_episodes=3, render=True, # comment out to speed up )