From 8c27a62e042cbf444c829f4ae97d9d3bdabaff51 Mon Sep 17 00:00:00 2001 From: Jie Tan Date: Fri, 10 Mar 2017 13:41:05 -0800 Subject: [PATCH] remove the stub calls from rllab --- .../gym/minitaurWalk_bullet_gym_example.py | 27 ------------------- .../pybullet/gym/trpo_cartpole_bullet_gym.py | 22 +-------------- .../gym/trpo_tf_cartpole_bullet_gym.py | 15 +---------- 3 files changed, 2 insertions(+), 62 deletions(-) delete mode 100644 examples/pybullet/gym/minitaurWalk_bullet_gym_example.py diff --git a/examples/pybullet/gym/minitaurWalk_bullet_gym_example.py b/examples/pybullet/gym/minitaurWalk_bullet_gym_example.py deleted file mode 100644 index 4da575341..000000000 --- a/examples/pybullet/gym/minitaurWalk_bullet_gym_example.py +++ /dev/null @@ -1,27 +0,0 @@ -"""One-line documentation for gym_example module. - -A detailed description of gym_example. -""" - -import gym -from envs.bullet.minitaur import MinitaurWalkEnv -import setuptools -import time -import numpy as np - - -def main(): - env = gym.make('MinitaurWalkEnv-v0') - for i_episode in range(1): - observation = env.reset() - done = False - while not done: - print(observation) - action = np.array([1.3, 0, 0, 0, 1.3, 0, 0, 0, 1.3, 3.14, 0, 0, 1.3, 3.14, 0, 0]) - print(action) - observation, reward, done, info = env.step(action) - if done: - print("Episode finished after {} timesteps".format(t+1)) - break - -main() diff --git a/examples/pybullet/gym/trpo_cartpole_bullet_gym.py b/examples/pybullet/gym/trpo_cartpole_bullet_gym.py index 4c257cf6b..bac943217 100644 --- a/examples/pybullet/gym/trpo_cartpole_bullet_gym.py +++ b/examples/pybullet/gym/trpo_cartpole_bullet_gym.py @@ -3,12 +3,7 @@ from rllab.algos.trpo import TRPO from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.gym_env import GymEnv from rllab.envs.normalized_env import normalize -from rllab.misc.instrument import stub, run_experiment_lite from rllab.policies.gaussian_mlp_policy import GaussianMLPPolicy -import subprocess -import time - -stub(globals()) env = normalize(GymEnv("CartPoleBulletEnv-v0")) @@ -33,19 +28,4 @@ algo = TRPO( # plot=True, ) -#cmdStartBulletServer=['~/Projects/rllab/bullet_examples/run_physics_server.sh'] -#subprocess.Popen(cmdStartBulletServer, shell=True) -#time.sleep(1) - - -run_experiment_lite( - algo.train(), - # Number of parallel workers for sampling - n_parallel=1, - # Only keep the snapshot parameters for the last iteration - snapshot_mode="last", - # Specifies the seed for the experiment. If this is not provided, a random seed - # will be used - seed=1, - # plot=True, -) +algo.train() diff --git a/examples/pybullet/gym/trpo_tf_cartpole_bullet_gym.py b/examples/pybullet/gym/trpo_tf_cartpole_bullet_gym.py index 0e6c1353b..6e055be15 100644 --- a/examples/pybullet/gym/trpo_tf_cartpole_bullet_gym.py +++ b/examples/pybullet/gym/trpo_tf_cartpole_bullet_gym.py @@ -6,9 +6,6 @@ from sandbox.rocky.tf.envs.base import TfEnv from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline from rllab.envs.gym_env import GymEnv from rllab.envs.normalized_env import normalize -from rllab.misc.instrument import stub, run_experiment_lite - -stub(globals()) env = TfEnv(normalize(GymEnv("CartPoleBulletEnv-v0"))) @@ -35,14 +32,4 @@ algo = TRPO( #plot=True, ) -run_experiment_lite( - algo.train(), - # Number of parallel workers for sampling - n_parallel=1, - # Only keep the snapshot parameters for the last iteration - snapshot_mode="last", - # Specifies the seed for the experiment. If this is not provided, a random seed - # will be used - seed=1, - #plot=True, -) +algo.train()