Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning in quickstart.py #823

Merged
merged 3 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ jobs:
TESTFILES=$(circleci tests glob "tests/**/test*.py" | circleci tests split --split-by=timings)
echo "This shard testing: ${TESTFILES}"
pytest -n auto --junitxml=/tmp/test-reports/junit.xml -vv $TESTFILES
environment:
# This is needed in newer versions of pygame. See
# https://github.com/pygame/pygame/issues/3835#issuecomment-1703717368
SDL_VIDEODRIVER: dummy

- save-pytest-cache
- store-test-output-unix
Expand Down
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
Loading