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

SQIL and PC performance check fixes #811

Merged
merged 5 commits into from
Oct 22, 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
6 changes: 3 additions & 3 deletions tests/algorithms/test_preference_comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ def test_that_trainer_improves(
novice_agent_rewards, _ = evaluation.evaluate_policy(
agent_trainer.algorithm.policy,
action_is_reward_venv,
25,
50,
return_episode_rewards=True,
)

Expand All @@ -1077,7 +1077,7 @@ def test_that_trainer_improves(
# after this training, and thus `later_rewards` should have lower loss.
first_reward_network_stats = main_trainer.train(20, 20)

later_reward_network_stats = main_trainer.train(50, 20)
later_reward_network_stats = main_trainer.train(100, 40)
assert (
first_reward_network_stats["reward_loss"]
> later_reward_network_stats["reward_loss"]
Expand All @@ -1087,7 +1087,7 @@ def test_that_trainer_improves(
trained_agent_rewards, _ = evaluation.evaluate_policy(
agent_trainer.algorithm.policy,
action_is_reward_venv,
25,
50,
return_episode_rewards=True,
)

Expand Down
12 changes: 7 additions & 5 deletions tests/algorithms/test_sqil.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _test_sqil_no_crash(
rl_algo_class=rl_algo_class,
rl_kwargs=rl_kwargs,
)
model.train(total_timesteps=5000)
model.train(total_timesteps=500)


def test_sqil_no_crash_discrete(
Expand All @@ -104,7 +104,7 @@ def test_sqil_no_crash_discrete(
cartpole_venv,
"seals/CartPole-v0",
rl_algo_class=dqn.DQN,
rl_kwargs=dict(learning_starts=1000),
rl_kwargs=dict(learning_starts=100),
)


Expand Down Expand Up @@ -143,7 +143,7 @@ def _test_sqil_few_demonstrations(
rl_algo_class=rl_algo_class,
rl_kwargs=rl_kwargs,
)
model.train(total_timesteps=1_000)
model.train(total_timesteps=1_00)


def test_sqil_few_demonstrations_discrete(
Expand All @@ -157,7 +157,7 @@ def test_sqil_few_demonstrations_discrete(
cartpole_venv,
"seals/CartPole-v0",
rl_algo_class=dqn.DQN,
rl_kwargs=dict(learning_starts=10),
rl_kwargs=dict(learning_starts=10, seed=42),
)


Expand All @@ -174,6 +174,7 @@ def test_sqil_few_demonstrations_continuous(
pendulum_single_venv,
"Pendulum-v1",
rl_algo_class=rl_algo_class,
rl_kwargs=dict(seed=42),
)


Expand Down Expand Up @@ -203,7 +204,7 @@ def _test_sqil_performance(
return_episode_rewards=True,
)

model.train(total_timesteps=10_000)
model.train(total_timesteps=1_000)

venv.seed(SEED)
rewards_after, _ = evaluate_policy(
Expand Down Expand Up @@ -239,6 +240,7 @@ def test_sqil_performance_discrete(
)


@pytest.mark.skip(reason="This test is flaky.")
@pytest.mark.parametrize("rl_algo_class", RL_ALGOS_CONT_ACTIONS)
def test_sqil_performance_continuous(
rng: np.random.Generator,
Expand Down
Loading