GithubHelp home page GithubHelp logo

ut-austin-rpl / maple Goto Github PK

View Code? Open in Web Editor NEW
69.0 2.0 12.0 15.02 MB

Official codebase for Manipulation Primitive-augmented reinforcement Learning (MAPLE)

License: MIT License

Python 100.00%
robot-manipulation robot-learning reinforcement-learning

maple's Introduction

MAPLE: Augmenting Reinforcement Learning with Behavior Primitives for Diverse Manipulation Tasks

This is the official codebase for Manipulation Primitive-augmented reinforcement Learning (MAPLE), from the following paper:

Augmenting Reinforcement Learning with Behavior Primitives for Diverse Manipulation Tasks
Soroush Nasiriany, Huihan Liu, Yuke Zhu
UT Austin Robot Perception and Learning Lab
IEEE International Conference on Robotics and Automation (ICRA), 2022
[Paper] [Project Website]

This guide contains information about (1) Installation, (2) Running Experiments, (3) Setting Up Your Own Environments, (4) Acknowledgement, and (5) Citation.

Installation

Download code

  • Current codebase: git clone https://github.com/UT-Austin-RPL/maple
  • (for environments) the maple branch in robosuite: git clone -b maple https://github.com/ARISE-Initiative/robosuite

Setup robosuite

  1. Download MuJoCo 2.0 (Linux and Mac OS X) and unzip its contents into ~/.mujoco/mujoco200, and copy your MuJoCo license key ~/.mujoco/mjkey.txt. You can obtain a license key from here.
  2. (linux) Setup additional dependencies: sudo apt install libgl1-mesa-dev libgl1-mesa-glx libglew-dev libosmesa6-dev software-properties-common net-tools xpra xserver-xorg-dev libglfw3-dev patchelf
  3. Add MuJoCo to library paths: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/.mujoco/mujoco200/bin

Setup conda environment

  1. Create the conda environment: conda env create --name maple --file=maple.yml
  2. (if above fails) edit maple.yml to modify dependencies and then resume setup: conda env update --name maple --file=maple.yml
  3. Activate the conda environment: conda activate maple
  4. Finish maple setup: (in your maple repo path do) pip install -e .
  5. Finish robosuite setup: (in your robosuite repo path do) pip install -e .

Running Experiments

Scripts for training policies and re-playing policy checkpoints are located in scripts/train.py and scripts/eval.py, respectively.

These experiment scripts use the following structure:

base_variant = dict(
  # default hyperparam settings for all envs
)

env_params = {
  '<env1>' : {
    # add/override default hyperparam settings for specific env
    # each setting is specified as a dictionary address (key),
    # followed by list of possible options (value).
    # Example in following line:
    # 'env_variant.controller_type': ['OSC_POSITION'],
  },
  '<env2>' : {
    ...
  },
}

Command Line Options

See parser in scripts/train.py for a complete list of options. Some notable options:

  • env: the env to run (eg. stack)
  • label: name for experiment
  • debug: run with lite options for debugging

Plotting Experiment Results

During training, the results will be saved to a file called under LOCAL_LOG_DIR/<env>/<exp_prefix>/<foldername>. Inside this folder, the experiment results are stored in progress.csv. We recommend using viskit to plot the results.

Setting Up Your Own Environments

Note that this codebase is designed to work with robosuite environments only. For setting up your own environments, please follow these examples for reference. Notably, you will need to add the skill_config variable to the constructor, and define the keypoints for the affordance score by implementing the _get_skill_info function.

If you would like to know the inner workings of the primitives, refer to skill_controller.py and skills.py. Note that we use the term "skill" to refer to behavior primitives in the code.

Acknowledgement

Much of this codebase is directly based on RLkit, which itself is based on rllab. In addition, the environments were developed as a forked branch of robosuite v1.1.0.

Citation

@inproceedings{nasiriany2022maple,
   title={Augmenting Reinforcement Learning with Behavior Primitives for Diverse Manipulation Tasks},
   author={Soroush Nasiriany and Huihan Liu and Yuke Zhu},
   booktitle={IEEE International Conference on Robotics and Automation (ICRA)},
   year={2022}
}

maple's People

Contributors

snasiriany 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

Watchers

 avatar  avatar

maple's Issues

Questioun on Variable 'aff_threshold' and 'global_xyz_bounds'

Hello, I'm trying to add a new primitive types on your code.
Before questions, I'm really appreciate your work! Thanks a lot.

Anyway, I cannot understand the 'aff_threshold' and 'global_xyz_bounds'.
As I read the paper, 'aff_threshold' variable may be used when the network chooses a proper primitive with softmax returned value.
However, 'reach' primitive does not have an 'aff_threshold' variable. Does it use base_config's aff_threshold?
Also, the skill 'open' (Gripper Release) information was not in skill_config. Where can I see its code?

To 'global_xyz_bounds' as I guessed, 'global_xyz_bounds' may be the threshold of checking primitives in the network. Is it right?

Thank you for reading this questions.

Speed and params question on MAPLE

HI, Thanks for your maple project!

I encountered some problems when I was trying train my own model and env

1.How to accelerate my training? Because I find maple is half as slow as benchmarking? Are there any settings or args that can speed up training?

2.Because I'm using my own robot and have changed the env(such as peg and hole's position) based on peg_ins, are there any settings or args in base_variant or env_params that I need to modify?

I would appreciate for your reply!!

error in dowloading robosuite maple branch

Hi,

I have donwloaded the corresponding robosuite branch into the same folder as where maple locates. I also move to the robosuite directory and run python setup.py install. After installation, it seems that when my terminal is inside the robosuite directory, I can succesfully import robosuite, however, when outside of the directory, e.g. in the maple directory, I encounter the following issue when importing robosuite,

from robosuite.environments.manipulation.lift import Lift ModuleNotFoundError: No module named 'robosuite.environments.manipulation'

Any suggestions would be appreciated.

can not run robosuite-maple(ValueError: numpy.ndarray size changed)

(maple) summer@xxw-OMEN:~/maple$ python test_mujoco_py.py
Traceback (most recent call last):
File "test_mujoco_py.py", line 1, in
import mujoco_py
File "/home/summer/anaconda3/envs/maple/lib/python3.8/site-packages/mujoco_py/init.py", line 3, in
from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
File "/home/summer/anaconda3/envs/maple/lib/python3.8/site-packages/mujoco_py/builder.py", line 510, in
cymj = load_cython_ext(mujoco_path)
File "/home/summer/anaconda3/envs/maple/lib/python3.8/site-packages/mujoco_py/builder.py", line 101, in load_cython_ext
mod = load_dynamic_ext('cymj', cext_so_path)
File "/home/summer/anaconda3/envs/maple/lib/python3.8/site-packages/mujoco_py/builder.py", line 125, in load_dynamic_ext
return loader.load_module()
File "mujoco_py/cymj.pyx", line 1, in init mujoco_py.cymj
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 80 from PyObject

or

(maple) summer@xxw-OMEN:~/robosuite_maple$ python robosuite/demos/demo_random_action.py
Traceback (most recent call last):
File "robosuite/demos/demo_random_action.py", line 1, in
from robosuite.controllers import load_controller_config
File "/home/summer/robosuite_maple/robosuite/init.py", line 1, in
from robosuite.environments.base import make
File "/home/summer/robosuite_maple/robosuite/environments/init.py", line 1, in
from .base import REGISTERED_ENVS, MujocoEnv
File "/home/summer/robosuite_maple/robosuite/environments/base.py", line 2, in
from mujoco_py import MjSim, MjRenderContextOffscreen
File "/home/summer/anaconda3/envs/maple/lib/python3.8/site-packages/mujoco_py/init.py", line 3, in
from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
File "/home/summer/anaconda3/envs/maple/lib/python3.8/site-packages/mujoco_py/builder.py", line 510, in
cymj = load_cython_ext(mujoco_path)
File "/home/summer/anaconda3/envs/maple/lib/python3.8/site-packages/mujoco_py/builder.py", line 101, in load_cython_ext
mod = load_dynamic_ext('cymj', cext_so_path)
File "/home/summer/anaconda3/envs/maple/lib/python3.8/site-packages/mujoco_py/builder.py", line 125, in load_dynamic_ext
return loader.load_module()
File "mujoco_py/cymj.pyx", line 1, in init mujoco_py.cymj
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 80 from PyObject

My MAPLE env is below:(the env come from : conda env create --name maple --file=maple.yml)

(I'm a novice, i am insterest in this project and i really want to run the experiments)

(maple) summer@xxw-OMEN:~/robosuite_maple$ conda list

packages in environment at /home/summer/anaconda3/envs/maple:

Name Version Build Channel

_libgcc_mutex 0.1 main
absl-py 0.12.0
addict 2.4.0
anyio 3.3.1
argon2-cffi 20.1.0 py38h27cfd23_1
astunparse 1.6.3
async_generator 1.10 pyhd3eb1b0_0
attrs 21.4.0 pyhd3eb1b0_0
attrs 20.2.0
Babel 2.9.1
backcall 0.2.0 pyhd3eb1b0_0
bleach 3.3.0 pyhd3eb1b0_0
ca-certificates 2021.1.19 h06a4308_1
cachetools 4.2.1
certifi 2020.12.5 py38h06a4308_0
cffi 1.14.2
cffi 1.15.0 py38hd667e15_1
chardet 3.0.4
clang 5.0
click 7.1.2
cloudpickle 1.3.0
cycler 0.10.0
Cython 0.29.21
dbus 1.13.18 hb2f20db_0
decorator 4.4.2 pyhd3eb1b0_0
defusedxml 0.7.1 pyhd3eb1b0_0
deprecation 2.1.0
dill 0.3.4
entrypoints 0.3 py38_0
expat 2.3.0 h2531618_2
fasteners 0.15
Flask 1.0.2
flatbuffers 1.12
fontconfig 2.13.1 h6c09931_0
freetype 2.10.4 h5ab3b9f_0
future 0.18.2
gast 0.4.0
gitdb 4.0.2
gitdb2 2.0.6
GitPython 2.1.7
glfw 1.12.0
glib 2.68.0 h36276a3_0
google-api-core 1.26.0
google-api-python-client 1.12.8
google-auth 1.26.1
google-auth-httplib2 0.0.4
google-auth-oauthlib 0.4.4
google-cloud-core 1.6.0
google-cloud-storage 1.36.0
google-crc32c 1.1.2
google-pasta 0.2.0
google-resumable-media 1.2.0
googleapis-common-protos 1.52.0
grpcio 1.39.0
gst-plugins-base 1.14.0 h8213a91_2
gstreamer 1.14.0 h28cd5cc_2
gtimer 1.0.0b5
gym 0.17.2
h5py 3.1.0
httplib2 0.19.0
icu 58.2 he6710b0_3
idna 2.10
imageio 2.9.0
imageio-ffmpeg 0.4.4
importlib-metadata 3.7.3 py38h06a4308_1
importlib_metadata 3.7.3 hd3eb1b0_1
ipykernel 5.3.4 py38h5ca1d4c_0
ipython 7.22.0 py38hb070fc8_0
ipython_genutils 0.2.0 pyhd3eb1b0_1
ipywidgets 7.6.3 pyhd3eb1b0_1
itsdangerous 1.1.0
jedi 0.17.0 py38_0
Jinja2 2.11.2
jinja2 2.11.3 pyhd3eb1b0_0
joblib 1.0.1
jpeg 9b h024ee3a_2
json5 0.9.6
jsonschema 3.2.0 py_2
jupyter 1.0.0 py38_7
jupyter-core 4.6.3
jupyter-packaging 0.10.4
jupyter-server 1.11.0
jupyter_client 6.1.12 pyhd3eb1b0_0
jupyter_console 6.4.0 pyhd3eb1b0_0
jupyter_core 4.7.1 py38h06a4308_0
jupyterlab 3.1.12
jupyterlab-server 2.8.1
jupyterlab_pygments 0.1.2 py_0
jupyterlab_widgets 1.0.0 pyhd3eb1b0_1
keras 2.6.0
Keras-Preprocessing 1.1.2
kiwisolver 1.3.2
ld_impl_linux-64 2.33.1 h53a641e_7
libedit 3.1.20191231 h14c3975_1
libffi 3.3 he6710b0_2
libgcc-ng 9.1.0 hdf63c60_0
libpng 1.6.37 hbc83047_0
libsodium 1.0.18 h7b6447c_0
libstdcxx-ng 9.1.0 hdf63c60_0
libuuid 1.0.3 h1bed415_2
libxcb 1.14 h7b6447c_0
libxml2 2.9.10 hb55368b_3
llvmlite 0.32.1
lockfile 0.12.2
maple 0.2.1.dev0
Markdown 3.3.4
markupsafe 1.1.1 py38h7b6447c_0
matplotlib 3.4.3
mistune 0.8.4 py38h7b6447c_1000
monotonic 1.5
moviepy 1.0.3
mujoco-py 2.0.2.9
nbclassic 0.3.1
nbclient 0.5.3 pyhd3eb1b0_0
nbconvert 6.0.7 py38_0
nbformat 5.0.8
nbformat 5.1.3 pyhd3eb1b0_0
ncurses 6.2 he6710b0_1
nest-asyncio 1.5.1 pyhd3eb1b0_0
networkx 2.6.2
notebook 6.3.0 py38h06a4308_0
numba 0.49.1
numpy 1.19.5
nvisii 1.1.72
oauthlib 3.1.0
open3d 0.13.0
opencv-python 4.4.0.44
openssl 1.1.1k h27cfd23_0
opt-einsum 3.3.0
packaging 20.9 pyhd3eb1b0_0
pandas 1.3.3
pandoc 2.12 h06a4308_0
pandocfilters 1.4.3 py38h06a4308_1
parso 0.8.1 pyhd3eb1b0_0
pcre 8.44 he6710b0_0
pexpect 4.8.0 pyhd3eb1b0_3
pickleshare 0.7.5 pyhd3eb1b0_1003
Pillow 8.3.2
pip 20.2.2 py38_0
plotly 3.4.2
proglog 0.1.9
progressbar2 3.53.1
prometheus_client 0.9.0 pyhd3eb1b0_0
prompt-toolkit 3.0.17 pyh06a4308_0
prompt_toolkit 3.0.17 hd3eb1b0_0
protobuf 3.14.0
psutil 5.8.0
ptyprocess 0.7.0 pyhd3eb1b0_2
pyasn1 0.4.8
pyasn1-modules 0.2.8
pybullet 2.6.9
pycparser 2.20 py_2
pyglet 1.5.0
pygments 2.8.1 pyhd3eb1b0_0
pyparsing 2.4.7 pyhd3eb1b0_0
pyqt 5.9.2 py38h05f1152_4
pyrsistent 0.17.3 py38h7b6447c_0
python 3.8.5 h7579374_1
python-dateutil 2.8.1 pyhd3eb1b0_0
python-utils 2.5.6
pytz 2020.4
PyWavelets 1.1.1
PyYAML 5.4.1
pyzmq 20.0.0 py38h2531618_1
qt 5.9.7 h5867ecd_1
qtconsole 5.0.3 pyhd3eb1b0_0
qtpy 1.9.0 py_0
readline 8.0 h7b6447c_0
requests 2.24.0
requests-oauthlib 1.3.0
requests-unixsocket 0.2.0
retrying 1.3.3
robosuite 1.1.0
rsa 4.7
scikit-image 0.18.2
scikit-learn 0.24.2
scikit-video 1.1.11
scipy 1.5.2
send2trash 1.5.0 pyhd3eb1b0_1
setuptools 49.6.0 py38_0
sip 4.19.13 py38he6710b0_0
six 1.15.0 py38h06a4308_0
smmap 3.0.5
smmap2 3.0.1
sniffio 1.2.0
sqlite 3.33.0 h62c20be_0
tensorboard 2.6.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.0
tensorboardX 2.4
tensorflow-estimator 2.6.0
tensorflow-gpu 2.6.0
termcolor 1.1.0
terminado 0.9.4 py38h06a4308_0
testpath 0.4.4 pyhd3eb1b0_0
threadpoolctl 2.2.0
tifffile 2021.8.8
tk 8.6.10 hbc83047_0
tomlkit 0.7.2
torch 1.6.0
torchvision 0.7.0
tornado 6.1 py38h27cfd23_0
tqdm 4.61.1
traitlets 5.0.5 pyhd3eb1b0_0
typing-extensions 3.7.4.3
uritemplate 3.0.1
urllib3 1.25.10
wcwidth 0.2.5 py_0
webencodings 0.5.1 py38_1
websocket-client 1.2.1
Werkzeug 1.0.1
wheel 0.37.1 pyhd3eb1b0_0
wheel 0.37.0
widgetsnbextension 3.5.1 py38_0
wrapt 1.12.1
xz 5.2.5 h7b6447c_0
zeromq 4.3.4 h2531618_0
zipp 3.4.1 pyhd3eb1b0_0
zlib 1.2.11 h7b6447c_3

error happens when run train.py

When I run train.py, an error happened. Could you please give some suggestions? Thank you very much !

Traceback (most recent call last):
  File "/home/xxx/Videos/bin/boot/maple/scripts/train.py", line 247, in <module>
    run_experiment(
  File "/home/xxx/Videos/bin/boot/maple/maple/launchers/launcher_util.py", line 593, in run_experiment
    return run_experiment_here(
  File "/home/xxx/Videos/bin/boot/maple/maple/launchers/launcher_util.py", line 168, in run_experiment_here
    return experiment_function(variant)
  File "/home/xxx/Videos/bin/boot/maple/maple/launchers/robosuite_launcher.py", line 51, in experiment
    expl_env = make_env(mode='expl')
  File "/home/xxx/Videos/bin/boot/maple/maple/launchers/robosuite_launcher.py", line 36, in make_env
    env = suite.make(
  File "/home/xxx/anaconda3/envs/TD/lib/python3.9/site-packages/robosuite/environments/base.py", line 40, in make
    return REGISTERED_ENVS[env_name](*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'table_offset'

No GUI when running python scripts/train.py --env stack

Hi there! When I run python scripts/train.py --env stack, there is no visualization of MuJoCo GUI and the screenshot below is what's in the terminal. I was wondering if this is expected? Are there any ways that I can display the GUI? Thanks a lot in advance!
Screenshot from 2022-07-20 11-18-25

ERROR: GLEW initalization error: Missing GL version

hello, I found that I could run python robosuite/scripts/collect_human_demonstrations.py but when I run python scripts/trainer.py --env stack .Error appeared as follows:
2022-04-01 21-06-16 的屏幕截图

I had put export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so in my .bashrc ,but It did not work.

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.