martius-lab/depRL

Add compatibility with the newest MyoSuite-Gymnasium update

Closed this issue · 7 comments

On the top of the to-do list

hi Pierre, was wondering if depRL can still be used to train an agent for myosuite? ive been running into an error when trying to train the MyoLeg agent for example. using python -m deprl.main myoLegWalk.json I get the following error:

raise error.NameNotFound( gym.error.NameNotFound: Environment myoLegWalk doesn't exist.

I get a similar error if I try to load the depRL baseline for walking:

import deprl
import gym
import myosuite

# we can pass arguments to the environments here
env = gym.make('myoLegWalk-v0', reset_type='random')
policy = deprl.load_baseline(env)
obs, _ = env.reset()
for i in range(1000):
    env.mj_render()
    action = policy(obs)
    obs, *_ = env.step(action)
    # obs, reward, done, _, _ = env.step(action)
env.close()

raise error.NameNotFound( gym.error.NameNotFound: Environment myoLegWalk doesn't exist.

but I can fix this by changing import gym to from myosuite.utils import gym

My environment info:
MacOS 14.4.1
python 3.8.19
deprl 0.3.2
myosuite 2.4.0

I also tried running a linux system:
python 3.9.19
deprl 0.4.0
myosuite 2.4.0

and I get the following error when attempting to train the MyoLeg agent:
raise error.UnregisteredEnv('No registered env with id: {}'.format(id)) gym.error.UnregisteredEnv: No registered env with id: myoLegWalk-v0

I'm wondering if this has anything to do with the the myosuite-gymnaisum update? apologies if this is better directed towards the myosuite GitHub, but I just noticed this open issue here. thank you!

-nikolay

That's right, the deprl code wasn't updated to work with the myosuite gymnasium code. I'll look into the necessary changes in order to make it work! any help is appreciated.

Hey,
I fixed the example code, but haven't taken a look at the training code yet. It seems to work from my side now.

Can you verify that it works for you? I started a new branch for this. Either checkout gymnasium_update or click on the following link:

state, reward, terminated, truncated, info = env.step(action)

Hey Pierre,

thank you so much for getting back to me! yes I also got the example code to work. Im still unable to get the training code to work though, but I will keep working on and definitely let you know.

I also posted the issue on myosuite that was maybe a little more clear: MyoHub/myosuite#185. Thank you again

Hi again,
I have pushed an update that might fix the training. Can you try it out now?
Please ignore the excessive warnings and credits on startup, I will fix those later.

I haven't time to test the training performance, so any feedback would be great!

Hi Pierre,
Thank you so much! Tested both on MacOS and linux and training appears to work! I'll keep you updated and will let you know how long it takes (and how many cores, gpu, ram, etc).

thank you again!

Closed with 84c3579