RL-ViGen icon indicating copy to clipboard operation
RL-ViGen copied to clipboard

Proposal : Portable version of the benchmark

Open AlexandreBrown opened this issue 1 year ago • 5 comments

Context

Hi, I like what has been done with RL-ViGen and I like that this benchmark exposes well that most approaches are not perfect in all scenarios. I think ideally, RL-ViGen should be used for future visual RL research.
That being said, I find it fairly hard to integrate with existing repositories which makes it impossible to use for research unless one re-writes his code for the RL-ViGen repo. Even then, it's hard to get it to work depending on your linux version for instance and using docker is not great for quick R&D/Debugging.
I really want to use RL-ViGen but given the complexity to integrate this might not be possible unless we get an option for a portable version.

Proposal

I would like to propose the idea of a portable version of the benchmark that would only contain the environments.
This would make it possible for people to simply create the environments and integrate it with their existing research repository which might already contain the instantiation of other environments, training code and more complex code that RL-ViGen doesn't have to maintain.
Other benchmarks seem to follow a similar approach (eg: https://github.com/vikashplus/robohive can be install via pip and we can create an env in a few lines of code).
It would be great if RL-ViGen could do the same or at least offer the option to only need the environments (no algorithms or training code or pre-established hydra configs, envs would be created in python and accept a dict).
This would also remove constraints like needing hydra, tensorboard, weight & biases or needing a specific PyTorch version (currently it is pinned in the repo which is far from ideal).

Ideal Solution

I think the ideal solution would be to be able to pip install RL-ViGen and the package could contain the envs and offer create functions like create_carla_envs etc.

Other Possible Solution

Prototype

I tried doing a prototype of another idea here : https://github.com/AlexandreBrown/RL-ViGen-Portable
The idea is to allow someone to go from an existing conda environment from an existing project repository and simply do :

  1. Clone the portable repo
  2. Install RL-ViGen dependencies: conda env update --file environment.yaml
  3. Create the RL-ViGen environments in code, example : from wrappers.habi_wrappers import make_habitat_env then env = make_habitat_env(...)

The repository is still WIP and while the conda update works right now, I still get issues when trying to create the environments in python. The goal of the repository was just to give an idea of the proposal but not necessarily to be the complete solution so I hope it gives the gist of the idea. The README contains additional details.

This might be trivial for someone already familiar with RL-ViGen (ie: The authors) so I am taking the time to ask if this could be added in the future via a branch (eg: envs-only) or even better pip install rl_vigen or something like that.

Thank you and feel free to give your feedback,

AlexandreBrown avatar Oct 01 '24 21:10 AlexandreBrown

@gemcollector Would love your feedback on this if possible :)

AlexandreBrown avatar Oct 01 '24 21:10 AlexandreBrown

Hi @AlexandreBrown , Thank you for your detailed proposal and illustration. We are delighted to see the portable version of rl-vigen, which simplifies the installation process and usage. We are also very willing to maintain the environment part as a branch of your repo. We do appreciate your support for our work!

gemcollector avatar Oct 03 '24 04:10 gemcollector

@gemcollector Ok this is great!
I just pushed a commit to the fork that makes Carla env work on Ubuntu 24.04 (should work on other versions as well).
To avoid OS-related issues I fixed issues like libtiff not found and other dependencies by adding it to conda env and I updated carla sim from 0.9.10 to 0.9.12 which now uses pip to install carla python api instead of a the egg file. Now carla also works on python 3.8 and 3.9 so I was able to remove the python 3.7 pinning (since carla 0.9.10 egg file is only for python 3.7).
I updated the carla env code to work with 0.9.12 as there were breaking changes from carla side.
You can see a working minimal example here : https://github.com/AlexandreBrown/RL-ViGen-Portable/blob/master/doc/carla/README.md
Now carla training and eval envs work.
I also made the code more portable by not setting the PYTHONPATH in code but rather before running the code (so no hard coding of files paths).

I did not make the changes for the other environments yet but so far carla works.

Let me know if that makes sense and let me know if you plan on contributing for the other envs because I might not have the bandwidth to do all the envs.
I cannot get robosuite to work, see : https://github.com/AlexandreBrown/RL-ViGen-Portable/blob/master/doc/robosuite/README.md
I get an error currently which blocks me from continuing :

Traceback (most recent call last):
  File "doc/robosuite/create_robo_env.py", line 1, in <module>
    from wrappers.robo_wrapper import robo_make
  File "/home/user/Documents/RL-ViGen-Portable/wrappers/robo_wrapper.py", line 2, in <module>
    from wrappers.dmc import ActionDTypeWrapper, ActionRepeatWrapper, ExtendedTimeStepWrapper
  File "/home/user/Documents/RL-ViGen-Portable/wrappers/dmc.py", line 10, in <module>
    from dm_control import manipulation, suite
  File "/home/user/Documents/RL-ViGen-Portable/envs/DMCVGB/dm_control/dm_control/manipulation/__init__.py", line 20, in <module>
    from dm_control import composer as _composer
  File "/home/user/Documents/RL-ViGen-Portable/envs/DMCVGB/dm_control/dm_control/composer/__init__.py", line 18, in <module>
    from dm_control.composer.arena import Arena
  File "/home/user/Documents/RL-ViGen-Portable/envs/DMCVGB/dm_control/dm_control/composer/arena.py", line 20, in <module>
    from dm_control import mjcf
  File "/home/user/Documents/RL-ViGen-Portable/envs/DMCVGB/dm_control/dm_control/mjcf/__init__.py", line 18, in <module>
    from dm_control.mjcf.attribute import Asset
  File "/home/user/Documents/RL-ViGen-Portable/envs/DMCVGB/dm_control/dm_control/mjcf/attribute.py", line 28, in <module>
    from dm_control.mujoco.wrapper import util
  File "/home/user/Documents/RL-ViGen-Portable/envs/DMCVGB/dm_control/dm_control/mujoco/__init__.py", line 18, in <module>
    from dm_control.mujoco.engine import action_spec
  File "/home/user/Documents/RL-ViGen-Portable/envs/DMCVGB/dm_control/dm_control/mujoco/engine.py", line 42, in <module>
    from dm_control.mujoco import index
  File "/home/user/Documents/RL-ViGen-Portable/envs/DMCVGB/dm_control/dm_control/mujoco/index.py", line 88, in <module>
    from dm_control.mujoco.wrapper import util
  File "/home/user/Documents/RL-ViGen-Portable/envs/DMCVGB/dm_control/dm_control/mujoco/wrapper/__init__.py", line 20, in <module>
    from dm_control.mujoco.wrapper.core import callback_context
  File "/home/user/Documents/RL-ViGen-Portable/envs/DMCVGB/dm_control/dm_control/mujoco/wrapper/core.py", line 28, in <module>
    from dm_control.mujoco.wrapper.mjbindings import mjlib  # pylint: disable=unused-import
ImportError: cannot import name 'mjlib' from 'dm_control.mujoco.wrapper.mjbindings' (/home/user/Documents/RL-ViGen-Portable/envs/DMCVGB/dm_control/dm_control/mujoco/wrapper/mjbindings/__init__.py)

I tried both MUJOCO_GL=osmesa and MUJOCO_GL=egl but both lead to the same issue.

AlexandreBrown avatar Oct 03 '24 18:10 AlexandreBrown

How should I reproduce this error? Directly install your repo?

gemcollector avatar Oct 05 '24 11:10 gemcollector

@gemcollector Yes to try to reproduce you can clone the repo, follow https://github.com/AlexandreBrown/RL-ViGen-Portable/tree/master?tab=readme-ov-file#portable-installation (you dont need gibson dataset for robosuite so you can skip that) then after that for robosuite env creation, follow : https://github.com/AlexandreBrown/RL-ViGen-Portable/blob/master/doc/robosuite/README.md#prerequisites.
You could also try using Ubuntu 24.04 with RL-ViGen and see if you get the same issue to compare.

AlexandreBrown avatar Oct 06 '24 15:10 AlexandreBrown