FurnitureBench

repository·main·Indexed 42 days ago

https://github.com/clvrai/furniture-bench

A benchmark for long-horizon, complex robotic manipulation tasks focused on real-world furniture assembly. It includes FurnitureSim (a simulator based on Isaac Gym), a large-scale teleoperation dataset, and integrated frameworks such as RoLF (Robot Learning Framework for Research), R3M, and VIP for representation learning and reinforcement learning.

Tokens
4.9K
Snippets
19
Records
26
Agent score
53%

What's inside FurnitureBench

  1. Overview of FurnitureBench

    main

    FurnitureBench is a benchmark designed for long-horizon, complex robotic manipulation tasks using real-world furniture assembly. It provides a reproducible platform featuring:

    • Long-horizon complex manipulation tasks
    • Standardized environment setup
    • Python-based robot control stack
    • FurnitureSim: A simulated environment for testing
    • Large-scale teleoperation dataset: Over 200 hours of data available

    For detailed implementation guides and tutorials, refer to the official documentation.

  2. RoLF Directory Structure

    main

    The rolf/ package is organized as follows:

    • main.py: Entry point that sets up experiments and triggers training via trainer.py.
    • trainer.py: Contains the core training and evaluation logic.
    • algorithms/: Implementations of RL (PPO, DDPG, TD3, SAC, Dreamer) and IL (BC, GAIL) algorithms.
    • config/: Hydra-based YAML configurations.
      • algo/: Algorithm-specific hyperparameters.
      • env/: Environment-specific hyperparameters.
    • networks/: Implementations of neural networks (e.g., policy and value functions).
    • utils/: Helper functions.
  3. Use VIP with TorchRL

    main

    VIP is integrated into TorchRL as a visual representation transform for Gym environments. After installing TorchRL, you can wrap an environment with VIPTransform to extract VIP representations from pixel observations.

    from torchrl.envs.transforms import VIPTransform
    # Assuming my_env is a TransformedEnv or similar
    env = TransformedEnv(my_env, VIPTransform(keys_in=["next_pixels"], download=True))
  4. Run Offline Reinforcement Learning training

    main

    Use train_offline.py to train models on various environments. You must specify the --env_name and a corresponding --config file.

    Locomotion (e.g., halfcheetah):

    python train_offline.py --env_name=halfcheetah-medium-expert-v2 --config=configs/mujoco_config.py

    AntMaze:

    python train_offline.py --env_name=antmaze-large-play-v0 --config=configs/antmaze_config.py --eval_episodes=100 --eval_interval=100000

    Kitchen and Adroit (e.g., pen-human):

    python train_offline.py --env_name=pen-human-v0 --config=configs/kitchen_config.py
    # Example for AntMaze
    python train_offline.py --env_name=antmaze-large-play-v0 --config=configs/antmaze_config.py --eval_episodes=100 --eval_interval=100000
  5. Install Implicit Q-Learning dependencies

    main

    To set up the environment for Implicit Q-Learning, upgrade pip, install the required packages from requirements.txt, and install a JAX wheel compatible with CUDA 11 and cuDNN 8.

    For other CUDA configurations, refer to the official JAX installation guide.

    pip install --upgrade pip
    
    pip install -r requirements.txt
    
    # Installs the wheel compatible with Cuda 11 and cudnn 8.
    pip install --upgrade "jax[cuda]>=0.2.27" -f https://storage.googleapis.com/jax-releases/jax_releases.html
  6. Implement a custom algorithm in RoLF

    main

    To add a new algorithm to the framework, you must implement the following components:

    • run.py: Experiment setup.
    • your_config.yaml: Hyperparameter configuration (compatible with Hydra).
    • your_trainer.py: Training and evaluation loops.
    • your_agent.py: The algorithm implementation.
    • your_rollout.py: Rollout logic.
    • your_network.py: Model architectures (policy, value functions, etc.).

    For a reference implementation, see the skill-chaining repository.

  7. Install the Robot Learning Framework for Research (RoLF)

    main

    To install RoLF, follow these steps in order:

    1. Set up MuJoCo: Download MuJoCo 2.1.0 (for mujoco-py) and MuJoCo 2.1.1 (for dm_control) into ~/.mujoco and update your LD_LIBRARY_PATH.
    2. Install System Dependencies: Install required Linux packages for MuJoCo, rendering (software or windowed), and MPI.
    3. Install PyTorch: Install a compatible version of PyTorch (e.g., 1.10.2 with CUDA 11.3).
    4. Install RoLF: Install the package in editable mode from the root directory.

    Prerequisites:

    • Ubuntu 18.04 or above
    • Python 3.9
    • MuJoCo 2.1.0 and MuJoCo 2.1.1
    # 1. MuJoCo Setup
    $ mkdir ~/.mujoco
    $ wget https://github.com/deepmind/mujoco/releases/download/2.1.0/mujoco210-linux-x86_64.tar.gz -O mujoco210_linux.tar.gz
    $ tar -xvzf mujoco210_linux.tar.gz -C ~/.mujoco/
    $ rm mujoco210_linux.tar.gz
    
    $ wget https://github.com/deepmind/mujoco/releases/download/2.1.1/mujoco-2.1.1-linux-x86_64.tar.gz -O mujoco211_linux.tar.gz
    $ tar -xvzf mujoco211_linux.tar.gz -C ~/.mujoco/
    $ rm mujoco211_linux.tar.gz
    
    $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/.mujoco/mujoco210/bin
    
    # 2. System Dependencies
    $ sudo apt-get install cmake libopenmpi-dev libgl1-mesa-dev libgl1-mesa-glx libosmesa6-dev patchelf libglew-dev
    
    # 3. PyTorch (Example for CUDA 11.3)
    $ pip3 install torch==1.10.2+cu113 torchvision==0.11.3+cu113 torchaudio==0.10.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
    
    # 4. RoLF Installation
    $ pip install -e .
  8. Install R3M

    main

    You can install R3M into an existing conda environment by running the editable install command from the repository root. Alternatively, you can create a fresh environment using the provided r3m_base.yaml file and then perform the editable installation.

    To verify the installation, attempt to import the package in a Python shell.

    # Install from an existing conda environment
    pip install -e .
    
    # Verify installation
    python -c "import r3m; print('Success')"
  9. Train VIP on a custom video dataset

    main

    You can train VIP from scratch using a custom video dataset. Your dataset must follow this directory structure:

    my_dataset_path/
        video0/
            0.png
            1.png
            ...
        video1/
        video2/
        ...

    Run the training script using train_vip.py with the appropriate dataset and datapath arguments.

    python train_vip.py --config-name=config_vip dataset=my_dataset_name datapath=my_dataset_path