Skip to content

Commit

Permalink
Fix warning in quickstart.py caused by not properly setting the rende…
Browse files Browse the repository at this point in the history
…r mode in the evaluation environment.
  • Loading branch information
ernestum committed Nov 30, 2023
1 parent 1af5e4d commit 81f8c8a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions examples/quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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
)
Expand Down

0 comments on commit 81f8c8a

Please sign in to comment.