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

Port from Stable Baselines 2 to 3 (test code only) #40

Merged
merged 4 commits into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ def get_readme() -> str:
"pytest-shard",
"pytest-xdist",
"pytype",
"stable-baselines>=2.8.0",
"tensorflow>=1.8.0,<2.0.0",
"stable-baselines3>=0.9.0",
]
DOCS_REQUIRE = [
"sphinx",
Expand Down
9 changes: 4 additions & 5 deletions tests/test_mujoco_rl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

import gym
import pytest
from stable_baselines import PPO2
from stable_baselines.common.evaluation import evaluate_policy
from stable_baselines.common.policies import MlpPolicy
import stable_baselines3
from stable_baselines3.common import evaluation

import seals # noqa: F401 Import required for env registration

Expand All @@ -17,9 +16,9 @@ def _eval_env(
) -> Tuple[float, float]: # pragma: no cover
"""Train PPO2 for `total_timesteps` on `env_name` and evaluate returns."""
env = gym.make(env_name)
model = PPO2(MlpPolicy, env)
model = stable_baselines3.PPO("MlpPolicy", env)
model.learn(total_timesteps=total_timesteps)
res = evaluate_policy(model, env)
res = evaluation.evaluate_policy(model, env)
assert isinstance(res[0], float)
return res

Expand Down