Giter VIP home page Giter VIP logo

Comments (5)

dementrock avatar dementrock commented on July 25, 2024

Hi @aravindr93, this is due to we haven't fully migrated to using the mujoco-py package yet, and rllab has its own mujoco setup instructions available as a bash script here: https://github.com/rllab/rllab/blob/master/scripts/setup_mujoco.sh

Alternatively, you can try changing the import statements import rllab.mujoco_py into import mujoco_py. I expect this to mostly work except maybe a few interface differences that should be easy to fix.

from rllab.

aravindr93 avatar aravindr93 commented on July 25, 2024

@dementrock Thanks. I'll try it out.

I have a related question: how different are the gym environments ported through rllab and the original gym environments. More specifically between gym_env and rllab_env1 in my prev comment.

I'm trying out a project to test robustness to model errors. For this, I need to perturb the model parameters when required and then test a pre-trained policy on this perturbed model. The env created through gym allows me to do: gym_env.model.<data> to change whatever I want. However, I don't get the same functionality with rllab_env1. Is it the same case if I import HopperEnv from rllab.envs.mujoco.hopper_env ?

Alternatively, what is the easiest way to train a policy on the environment created uisng gym_env = gym.make('Hopper-v1') without using the GymEnv wrapper? Thanks!

from rllab.

dementrock avatar dementrock commented on July 25, 2024

Hi @aravindr93, in general environments in gym are more polished, and, to my knowledge, some of the environment parameters are tweaked when ported into gym. If gym's environments fit your need I recommend using them directly.

Can you elaborate on why you want to train a policy without using the wrapper?

from rllab.

aravindr93 avatar aravindr93 commented on July 25, 2024

OK, I think I didn't explain the issue properly.

What I want to do is learn a policy on an environment; perturb the parameters of the environment; and test the returns in the perturbed environments. To perturb the parameters, what I would do is something like this:

import gym
gym_env = gym.make('Hopper-v1')
gym_env.model.body_mass = new_mass

(this requires creating a mutable copy as intermediate step). This doesn't seem to be possible when I get the model using GymEnv wrapper.

from rllab.envs.gym_env import GymEnv
rllab_env = GymEnv("Hopper-v1")
print rllab_env.model
AttributeError: 'GymEnv' object has no attribute 'model'

When we train a policy (say GaussianMLP), we usually pass on an env.spec that comes from a rllab env object. However, this spec is different from the specs of gym. Can you give me a few lines of code to train a policy on a gym environment without the GymEnv() wrapper? Thanks!

from rllab.

dementrock avatar dementrock commented on July 25, 2024

I see. Right now this is not achievable using the current interface. If you look at the implementation of GymEnv though, it's just a very thin wrapper on top of environments from gym. You could write a similar class that takes in an already constructed gym environment as input, rather than just the ID of the environment.

To access the model properly in the last example you can do print rllab_env.env.model.

from rllab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.