MyoHub / myosuite

MyoSuite is a collection of environments/tasks to be solved by musculoskeletal models simulated with the MuJoCo physics engine and wrapped in the OpenAI gym API.
https://sites.google.com/view/myosuite
Apache License 2.0
821 stars 103 forks source link

Error Training MyoLeg Agent with depRL #185

Open nikypopov opened 1 month ago

nikypopov commented 1 month ago

Issue: Error Training MyoLeg Agent with depRL

Hello!

I'm running into an error when trying to train the MyoLeg agent with depRL. Specifically, following this example

Steps to Reproduce

  1. Attempt to Train Agent:

    python -m deprl.main baselines_DEPRL/myoLegWalk.json

    Error:

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

I was able to reproduce the same error when just attempting to load a pre-trained depRL model with the following script:

  1. Load depRL Baseline for Walking:

    import gym
    import myosuite
    import deprl
    
    # we can also change the reset_type of the environment here
    env = gym.make('myoLegWalk-v0', reset_type='random')
    policy = deprl.load_baseline(env)
    
    for ep in range(5):
        obs, _ = env.reset()
        for i in range(1000):
            action = policy(obs)
            next_obs, reward, done, truncated, info = env.step(action)
            env.sim.renderer.render_to_window()
            obs = next_obs
            if done:
                break

    Error:

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

    And this error could be resolved changing the import statement for gym to:

    from myosuite.utils import gym

This does fix the issue in the above example script but does not resolve the training error.

  1. Attempted to Edit .json configuration file: I also tried changing the header tab in the configuration myoLegWalk.json file to:
 "tonic": {
     "header": "import deprl, myosuite\nfrom myosuite.utils import gym",   

however this didn't fix the issue and returned the same error.

I'm wondering if this has anything to do with a myosuite-gym (or gymnaisum) update? Any help would be greatly appreciated, thanks!

Configuration and Environment

MacOS Configuration:

Linux Configuration:

On Linux, attempting to train the MyoLeg agent yielded:

raise error.UnregisteredEnv('No registered env with id: {}'.format(id)) gym.error.UnregisteredEnv: No registered env with id:  myoLegWalk-v0
P-Schumacher commented 1 month ago

tracked here https://github.com/martius-lab/depRL/issues/6