Code Monkey home page Code Monkey logo

metamorph's People

Contributors

agrimgupta92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

metamorph's Issues

Bug or bad usage?

When I use:
gym.make("Unimal-v0", agent_name="floor-1409-1-13-01-12-18-30"),
it says:

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/home/miniconda3/lib/python3.9/site-packages/gym/envs/registration.py", line 676, in make

    return registry.make(id, **kwargs)

  File "/home/miniconda3/lib/python3.9/site-packages/gym/envs/registration.py", line 520, in make

    return spec.make(**kwargs)

  File "/home/miniconda3/lib/python3.9/site-packages/gym/envs/registration.py", line 140, in make

    env = cls(**_kwargs)

  File "/home/app/metamorph/metamorph/envs/tasks/task.py", line 17, in make_env

    env = globals()[env_func](xml, agent_name, **kwargs)

  File "/home/app/metamorph/metamorph/envs/tasks/locomotion.py", line 89, in make_env_locomotion

    env.reset()

  File "/home/app/metamorph/metamorph/envs/tasks/unimal.py", line 158, in reset

    obs = self.reset_model()

  File "/home/app/metamorph/metamorph/envs/tasks/unimal.py", line 185, in reset_model

    observation = self._get_obs()

  File "/home/app/metamorph/metamorph/envs/tasks/unimal.py", line 81, in _get_obs

    obs.update(module.observation_step(self, self.sim))

  File "/home/app/metamorph/metamorph/envs/modules/agent.py", line 231, in observation_step

    limb_obs = self.get_limb_obs(sim)

  File "/home/app/metamorph/metamorph/envs/modules/agent.py", line 149, in get_limb_obs

    obs["body_idx"] = self._get_one_hot_body_idx()

  File "/home/app/metamorph/metamorph/envs/modules/agent.py", line 195, in _get_one_hot_body_idx

    one_hot_encoding[rows, body_idxs] = 1

IndexError: index 8 is out of bounds for axis 1 with size 8

Have tried many agents in the test dir, no one works.

Trained Model

Great work!
Could you provide a trained model shown in the demo?

Thanks.

`manifest for nvidia` error

When I try setup by docker, the error occurred.

(simul) bak@bak:~/Projects/metamorph$ ./scripts/build_docker.sh
+ TAG=metamorph
+ PARENT=nvidia/cuda:11.1-cudnn8-devel-ubuntu20.04
+ INSTALL_SCRIPT=install_gpu_deps
++ id -u
+ USER_ID=1000
+ docker build -f docker/Dockerfile --build-arg PARENT_IMAGE=nvidia/cuda:11.1-cudnn8-devel-ubuntu20.04 --build-arg INSTALL_SCRIPT=install_gpu_deps --build-arg USER_ID=1000 -t metamorph .
Sending build context to Docker daemon  122.9MB
Step 1/35 : ARG PARENT_IMAGE
Step 2/35 : FROM $PARENT_IMAGE
manifest for nvidia/cuda:11.1-cudnn8-devel-ubuntu20.04 not found: manifest unknown: manifest unknown

Should I have to install cuda 11.1, cudnn8-devel version?

I created conda environment named simul. After the above error occurred, I installed cuda11.7 but it doesn't work.

`obs` is not a dictionary but only has str `'proprioceptive'`.

I got an error at class UnimalHeightObs(gym.ObservationWrapper), def observation(self, obs): from hfield.py

  File "/home/bak/Projects/metamorph/metamorph/envs/wrappers/hfield.py", line 211, in observation
    obs["torso_height"] = round(z_pos - 1, 3)
TypeError: 'str' object does not support item assignment

The def observation(self, obs): is called from class UnimalEnv(gym.Env): in unimal.py. Though the obs is a dictionary and has 'proprioceptive', 'edges' keys at the end of def reset(self):, obs is just a str 'proprioceptive' at def observation(self, obs): class UnimalHeightObs(gym.ObservationWrapper).

From the viewpoint of the train loop, the error occurs when the code creates (or initializes) the world environment. At ppo.py, obs cannot create at def train(self):.

To solve above issue, I added self.obs_temp = obs at def reset(self): at def reset(self): class UnimalEnv(gym.Env): and obs = self.obs_temp at class UnimalHeightObs(gym.ObservationWrapper), def observation(self, obs):to preserve obs information.

  • unimal.py
class UnimalEnv(gym.Env):
    """Superclass for all Unimal tasks."""

...........
...........
    ###########################################################################
    # Reset sim
    ###########################################################################
    def reset(self):
        if self.sim is None or cfg.ENV.NEW_SIM_ON_RESET:
            self.sim = self._get_sim()
        else:
            self.sim.reset()

        self.step_count = 0

        if self.viewer is not None:
            self.viewer.update_sim(self.sim)
        obs = self.reset_model()
        self._set_action_space()
        # This is just a temp initialization, the final obs space will depend
        # on SelectKeysWrapper
        self.observation_space = spu.convert_obs_to_space(obs)
        self.metadata["video.frames_per_second"] = int(np.round(1.0 / self.dt))
        self.obs_temp = obs  ### what I added

        return obs
  • hfield.py
class UnimalHeightObs(gym.ObservationWrapper):
    def __init__(self, env):
        super().__init__(env)
        self.observation_space = spu.update_obs_space(env, {"torso_height": (1,)})

    def observation(self, obs):
        obs = self.obs_temp   ### what I added
        x_pos, y_pos, z_pos = self.sim.data.get_body_xpos("torso/0")
   ........
   ........

After that, I got an error like below.

Process ForkProcess-3:
Traceback (most recent call last):
  File "/home/bak/Projects/metamorph/metamorph/envs/vec_env/subproc_vec_env.py", line 27, in worker
    remote.send([env.reset() for env in envs])
  File "/home/bak/Projects/metamorph/metamorph/envs/vec_env/subproc_vec_env.py", line 27, in <listcomp>
    remote.send([env.reset() for env in envs])
  File "/home/bak/Projects/metamorph/metamorph/envs/wrappers/multi_env_wrapper.py", line 40, in reset
    obs = self._env.reset()
  File "/home/bak/Projects/metamorph/metamorph/algos/ppo/envs.py", line 187, in reset
    observation = super(RecordEpisodeStatistics, self).reset(**kwargs)
  File "/home/bak/anaconda3/envs/metamorph/lib/python3.8/site-packages/gym/core.py", line 323, in reset
    return self.env.reset(**kwargs)
  File "/home/bak/Projects/metamorph/metamorph/algos/ppo/envs.py", line 169, in reset
    return self.env.reset(**kwargs)
  File "/home/bak/anaconda3/envs/metamorph/lib/python3.8/site-packages/gym/wrappers/time_limit.py", line 68, in reset
    return self.env.reset(**kwargs)
  File "/home/bak/anaconda3/envs/metamorph/lib/python3.8/site-packages/gym/wrappers/order_enforcing.py", line 42, in reset
    return self.env.reset(**kwargs)
  File "/home/bak/anaconda3/envs/metamorph/lib/python3.8/site-packages/gym/wrappers/env_checker.py", line 47, in reset
    return self.env.reset(**kwargs)
  File "/home/bak/anaconda3/envs/metamorph/lib/python3.8/site-packages/gym/core.py", line 379, in reset
    obs, info = self.env.reset(**kwargs)
ValueError: too many values to unpack (expected 2)

How can I fix these problems and check the result of your experiments?

I used Anaconda environment with mujoco-2.1.0 rather than Docker due to using free version of mujoco and using mujoco-py. Unfortunately, using mujoco after 2.1.0 does not support mujoco-py due to it has its own python binding.

Code for evaluation and visualization

Hello!

Thanks a lot for the great work and for providing the code!

Are there any code/scripts available for evaluation or visualization?

Thanks a lot your help!

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.