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

Add compatibility with the newest MyoSuite-Gymnasium update #6

Closed
P-Schumacher opened this issue Dec 17, 2023 · 7 comments
Closed

Add compatibility with the newest MyoSuite-Gymnasium update #6

P-Schumacher opened this issue Dec 17, 2023 · 7 comments
Assignees

Comments

@P-Schumacher
Copy link
Collaborator

On the top of the to-do list

@P-Schumacher P-Schumacher self-assigned this Dec 17, 2023
@nikypopov
Copy link

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

@P-Schumacher
Copy link
Collaborator Author

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.

@P-Schumacher
Copy link
Collaborator Author

P-Schumacher commented Jul 10, 2024

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)

@nikypopov
Copy link

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

@P-Schumacher
Copy link
Collaborator Author

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!

@nikypopov
Copy link

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!

@P-Schumacher
Copy link
Collaborator Author

Closed with 84c3579

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants