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

Moved sandbox.rocky.tf to rllab.tf #130

Open
wants to merge 2 commits into
base: integration
Choose a base branch
from
Open
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
15 changes: 7 additions & 8 deletions contrib/ros/envs/example_launchers/trpo_gazebo_sawyer_pnp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
import numpy as np
import rospy

from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline
from rllab.envs.normalized_env import normalize
from rllab.misc.instrument import run_experiment_lite

from sandbox.rocky.tf.algos.trpo import TRPO
from sandbox.rocky.tf.policies.gaussian_mlp_policy import GaussianMLPPolicy
from sandbox.rocky.tf.envs.base import TfEnv

from contrib.ros.envs.example_launchers import model_dir
from contrib.ros.envs.sawyer.pick_and_place_env import PickAndPlaceEnv
from contrib.ros.util.task_object_manager import TaskObject, TaskObjectManager

from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline
from rllab.envs.normalized_env import normalize
from rllab.misc.instrument import run_experiment_lite
from rllab.tf.algos.trpo import TRPO
from rllab.tf.envs.base import TfEnv
from rllab.tf.policies.gaussian_mlp_policy import GaussianMLPPolicy


def run_task(*_):
block = TaskObject(
Expand Down
17 changes: 8 additions & 9 deletions contrib/ros/envs/example_launchers/trpo_gazebo_sawyer_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
import numpy as np
import rospy

from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline
from rllab.envs.normalized_env import normalize
from rllab.misc.instrument import run_experiment_lite

from sandbox.rocky.tf.algos.trpo import TRPO
from sandbox.rocky.tf.policies.gaussian_mlp_policy import GaussianMLPPolicy
from sandbox.rocky.tf.envs.base import TfEnv

from contrib.ros.envs.example_launchers import model_dir
from contrib.ros.envs.sawyer.push_env import PushEnv
from contrib.ros.util.task_object_manager import TaskObject, TaskObjectManager

from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline
from rllab.envs.normalized_env import normalize
from rllab.misc.instrument import run_experiment_lite
from rllab.tf.algos.trpo import TRPO
from rllab.tf.envs.base import TfEnv
from rllab.tf.policies.gaussian_mlp_policy import GaussianMLPPolicy


def run_task(*_):
table = TaskObject(
Expand Down Expand Up @@ -75,4 +74,4 @@ def run_task(*_):
run_task,
n_parallel=1,
plot=False,
)
)
12 changes: 6 additions & 6 deletions examples/cluster_gym_mujoco_demo.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import sys

from rllab.baselines import LinearFeatureBaseline
from rllab.envs import GymEnv
from rllab.envs import normalize
from sandbox.rocky.tf.envs import TfEnv
from sandbox.rocky.tf.policies import GaussianMLPPolicy
from sandbox.rocky.tf.algos import TRPO
from rllab.misc import run_experiment_lite
from rllab.envs import GymEnv
import sys

from rllab.misc import VariantGenerator, variant
from rllab.tf.algos import TRPO
from rllab.tf.envs import TfEnv
from rllab.tf.policies import GaussianMLPPolicy


class VG(VariantGenerator):
Expand Down
7 changes: 3 additions & 4 deletions examples/trpo_gym_tf_cartpole.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
from rllab.envs import GymEnv
from rllab.envs import normalize
from rllab.misc import stub, run_experiment_lite

from sandbox.rocky.tf.envs import TfEnv
from sandbox.rocky.tf.policies import CategoricalMLPPolicy
from sandbox.rocky.tf.algos import TRPO
from rllab.tf.algos import TRPO
from rllab.tf.envs import TfEnv
from rllab.tf.policies import CategoricalMLPPolicy

stub(globals())

Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions rllab/tf/algos/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from rllab.tf.algos.batch_polopt import BatchPolopt
from rllab.tf.algos.npo import NPO
from rllab.tf.algos.trpo import TRPO
from rllab.tf.algos.vpg import VPG
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import time

import tensorflow as tf

from rllab.algos import RLAlgorithm
import rllab.misc.logger as logger
from sandbox.rocky.tf.policies.base import Policy
import tensorflow as tf
from sandbox.rocky.tf.samplers import BatchSampler
from sandbox.rocky.tf.samplers import VectorizedSampler
from rllab.sampler.utils import rollout
from rllab.tf.policies.base import Policy
from rllab.tf.samplers import BatchSampler
from rllab.tf.samplers import VectorizedSampler


class BatchPolopt(RLAlgorithm):
Expand Down Expand Up @@ -103,7 +105,7 @@ def train(self, sess=None):
if sess is None:
sess = tf.Session()
sess.__enter__()

sess.run(tf.global_variables_initializer())
self.start_worker()
start_time = time.time()
Expand Down
File renamed without changes.
11 changes: 5 additions & 6 deletions sandbox/rocky/tf/algos/npo.py → rllab/tf/algos/npo.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@


import tensorflow as tf

from rllab.misc import ext
from rllab.misc.overrides import overrides
import rllab.misc.logger as logger
from sandbox.rocky.tf.optimizers import PenaltyLbfgsOptimizer
from sandbox.rocky.tf.algos import BatchPolopt
from sandbox.rocky.tf.misc import tensor_utils
from sandbox.rocky.tf.misc.tensor_utils import enclosing_scope
import tensorflow as tf
from rllab.tf.algos import BatchPolopt
from rllab.tf.misc import tensor_utils
from rllab.tf.misc.tensor_utils import enclosing_scope
from rllab.tf.optimizers import PenaltyLbfgsOptimizer


class NPO(BatchPolopt):
Expand Down
6 changes: 2 additions & 4 deletions sandbox/rocky/tf/algos/trpo.py → rllab/tf/algos/trpo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@


from sandbox.rocky.tf.algos import NPO
from sandbox.rocky.tf.optimizers import ConjugateGradientOptimizer
from rllab.tf.algos import NPO
from rllab.tf.optimizers import ConjugateGradientOptimizer


class TRPO(NPO):
Expand Down
13 changes: 6 additions & 7 deletions sandbox/rocky/tf/algos/vpg.py → rllab/tf/algos/vpg.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import tensorflow as tf


from rllab.core import Serializable
from rllab.misc import logger
from rllab.misc import ext
from rllab.misc.overrides import overrides
from sandbox.rocky.tf.algos import BatchPolopt
from sandbox.rocky.tf.optimizers import FirstOrderOptimizer
from sandbox.rocky.tf.misc import tensor_utils
from sandbox.rocky.tf.misc.tensor_utils import enclosing_scope
from rllab.core import Serializable
import tensorflow as tf
from rllab.tf.algos import BatchPolopt
from rllab.tf.misc import tensor_utils
from rllab.tf.misc.tensor_utils import enclosing_scope
from rllab.tf.optimizers import FirstOrderOptimizer


class VPG(BatchPolopt, Serializable):
Expand Down
8 changes: 8 additions & 0 deletions rllab/tf/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from rllab.tf.core import layers
from rllab.tf.core.layers_powered import LayersPowered
from rllab.tf.core.network import MLP
from rllab.tf.core.network import GRUNetwork
from rllab.tf.core.network import ConvNetwork
from rllab.tf.core.network import LSTMNetwork
from rllab.tf.core.parameterized import JointParameterized
from rllab.tf.core.parameterized import Parameterized
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from sandbox.rocky.tf.core import Parameterized
from sandbox.rocky.tf.core import layers as L
import itertools

from rllab.tf.core import Parameterized
from rllab.tf.core import layers as L


class LayersPowered(Parameterized):

Expand Down
12 changes: 7 additions & 5 deletions sandbox/rocky/tf/core/network.py → rllab/tf/core/network.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from sandbox.rocky.tf.core import layers as L
import tensorflow as tf
import numpy as np
import itertools

import numpy as np
import tensorflow as tf

from rllab.core import Serializable
from sandbox.rocky.tf.core import Parameterized
from sandbox.rocky.tf.core import LayersPowered
from rllab.tf.core import layers as L
from rllab.tf.core import Parameterized
from rllab.tf.core import LayersPowered


class MLP(LayersPowered, Serializable):
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions rllab/tf/distributions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from rllab.tf.distributions.base import Distribution
from rllab.tf.distributions.bernoulli import Bernoulli
from rllab.tf.distributions.categorical import Categorical
from rllab.tf.distributions.diagonal_gaussian import DiagonalGaussian
from rllab.tf.distributions.recurrent_categorical import RecurrentCategorical
from rllab.tf.distributions.recurrent_diagonal_gaussian import RecurrentDiagonalGaussian
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@


from .base import Distribution
import tensorflow as tf
import numpy as np
from sandbox.rocky.tf.misc.tensor_utils import enclosing_scope
import tensorflow as tf

from rllab.distributions.base import Distribution
from rllab.tf.misc.tensor_utils import enclosing_scope

TINY = 1e-8

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import numpy as np
from .base import Distribution
import tensorflow as tf
from sandbox.rocky.tf.misc.tensor_utils import enclosing_scope

from rllab.distributions.base import Distribution
from rllab.tf.misc.tensor_utils import enclosing_scope

TINY = 1e-8

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@



import tensorflow as tf
import numpy as np
from sandbox.rocky.tf.distributions import Distribution
from sandbox.rocky.tf.misc.tensor_utils import enclosing_scope
import tensorflow as tf

from rllab.tf.distributions import Distribution
from rllab.tf.misc.tensor_utils import enclosing_scope


class DiagonalGaussian(Distribution):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import tensorflow as tf
import numpy as np
from sandbox.rocky.tf.misc.tensor_utils import enclosing_scope
from sandbox.rocky.tf.distributions import Categorical
from sandbox.rocky.tf.distributions import Distribution
import tensorflow as tf

from rllab.tf.distributions import Categorical
from rllab.tf.distributions import Distribution
from rllab.tf.misc.tensor_utils import enclosing_scope

TINY = 1e-8

Expand Down
3 changes: 3 additions & 0 deletions rllab/tf/distributions/recurrent_diagonal_gaussian.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from rllab.tf.distributions import DiagonalGaussian

RecurrentDiagonalGaussian = DiagonalGaussian
4 changes: 4 additions & 0 deletions rllab/tf/envs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from rllab.tf.envs.base import TfEnv
from rllab.tf.envs.base import to_tf_space
from rllab.tf.envs.parallel_vec_env_executor import ParallelVecEnvExecutor
from rllab.tf.envs.vec_env_executor import VecEnvExecutor
6 changes: 3 additions & 3 deletions sandbox/rocky/tf/envs/base.py → rllab/tf/envs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from rllab.spaces import Box as TheanoBox
from rllab.spaces import Discrete as TheanoDiscrete
from rllab.spaces import Product as TheanoProduct
from sandbox.rocky.tf.spaces import Discrete
from sandbox.rocky.tf.spaces import Box
from sandbox.rocky.tf.spaces import Product
from rllab.tf.spaces import Discrete
from rllab.tf.spaces import Box
from rllab.tf.spaces import Product
from cached_property import cached_property


Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

import uuid

import numpy as np
import pickle as pickle
from sandbox.rocky.tf.misc import tensor_utils
from rllab.misc import logger

from rllab.misc import logger
from rllab.sampler import singleton_pool
import uuid
from rllab.tf.misc import tensor_utils


def worker_init_envs(G, alloc, scope, env):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import numpy as np
import pickle as pickle
from sandbox.rocky.tf.misc import tensor_utils
from rllab.tf.misc import tensor_utils


class VecEnvExecutor(object):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from sandbox.rocky.tf.algos import TRPO
from rllab.baselines import LinearFeatureBaseline
from rllab.envs.box2d import CartpoleEnv
from rllab.envs.normalized_env import normalize
from sandbox.rocky.tf.optimizers import ConjugateGradientOptimizer
from sandbox.rocky.tf.optimizers import FiniteDifferenceHvp
from sandbox.rocky.tf.policies import GaussianMLPPolicy
from sandbox.rocky.tf.envs import TfEnv
from rllab.misc import stub, run_experiment_lite
from rllab.tf.algos import TRPO
from rllab.tf.envs import TfEnv
from rllab.tf.optimizers import ConjugateGradientOptimizer
from rllab.tf.optimizers import FiniteDifferenceHvp
from rllab.tf.policies import GaussianMLPPolicy

env = TfEnv(normalize(CartpoleEnv()))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from sandbox.rocky.tf.algos import TRPO
from rllab.baselines import LinearFeatureBaseline
from rllab.envs.box2d import CartpoleEnv
from rllab.envs import normalize
from sandbox.rocky.tf.policies import GaussianGRUPolicy
from sandbox.rocky.tf.policies import GaussianLSTMPolicy
from sandbox.rocky.tf.envs import TfEnv
import sandbox.rocky.tf.core.layers as L
from sandbox.rocky.tf.optimizers import ConjugateGradientOptimizer, FiniteDifferenceHvp
from rllab.misc import stub, run_experiment_lite
from rllab.tf.algos import TRPO
import rllab.tf.core.layers as L
from rllab.tf.envs import TfEnv
from rllab.tf.optimizers import ConjugateGradientOptimizer, FiniteDifferenceHvp
from rllab.tf.policies import GaussianGRUPolicy
from rllab.tf.policies import GaussianLSTMPolicy


env = TfEnv(normalize(CartpoleEnv()))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from sandbox.rocky.tf.algos import VPG
from rllab.baselines import LinearFeatureBaseline
from rllab.envs.box2d import CartpoleEnv
from rllab.envs import normalize
from sandbox.rocky.tf.policies import GaussianMLPPolicy
from sandbox.rocky.tf.envs import TfEnv
from rllab.envs.box2d import CartpoleEnv
from rllab.misc import stub, run_experiment_lite
from rllab.tf.algos import VPG
from rllab.tf.envs import TfEnv
from rllab.tf.policies import GaussianMLPPolicy

env = TfEnv(normalize(CartpoleEnv()))

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import tensorflow as tf
import numpy as np
import tensorflow as tf


def compile_function(inputs, outputs, log_name=None):
Expand Down
5 changes: 5 additions & 0 deletions rllab/tf/optimizers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from rllab.tf.optimizers.conjugate_gradient_optimizer import ConjugateGradientOptimizer
from rllab.tf.optimizers.conjugate_gradient_optimizer import FiniteDifferenceHvp
from rllab.tf.optimizers.first_order_optimizer import FirstOrderOptimizer
from rllab.tf.optimizers.lbfgs_optimizer import LbfgsOptimizer
from rllab.tf.optimizers.penalty_lbfgs_optimizer import PenaltyLbfgsOptimizer
Loading