Code for "MetaMorph: Learning Universal Controllers with Transformers", Gupta et al, ICLR 2022

Overview

MetaMorph: Learning Universal Controllers with Transformers

This is the code for the paper

MetaMorph: Learning Universal Controllers with Transformers
Agrim Gupta, Linxi Fan, Surya Ganguli, Fei-Fei Li

Multiple domains like vision, natural language, and audio are witnessing tremendous progress by leveraging Transformers for large scale pre-training followed by task specific fine tuning. In contrast, in robotics we primarily train a single robot for a single task. However, modular robot systems now allow for the flexible combination of general-purpose building blocks into task optimized morphologies. However, given the exponentially large number of possible robot morphologies, training a controller for each new design is impractical. In this work, we propose MetaMorph, a Transformer based approach to learn a universal controller over a modular robot design space. MetaMorph is based on the insight that robot morphology is just another modality on which we can condition the output of a Transformer. Through extensive experiments we demonstrate that large scale pre-training on a variety of robot morphologies results in policies with combinatorial generalization capabilities, including zero shot generalization to unseen robot morphologies. We further demonstrate that our pre-trained policy can be used for sample-efficient transfer to completely new robot morphologies and tasks.

Code Structure

The code consists of two main components:

  1. Metamorph: Code for joint pre-training of different robots.
  2. Environments and evaluation tasks: Three pre-training environments and two evaluation environments.

Benchmark

We also provide Unimal-100 benchmark. The benchmark consists of 100 train morphologies, 1600 morphologies with dynamics variations, 800 morphologies with kinematics variations, and 100 test morphologies.

# Install gdown
pip install gdown
# Download data
gdown 1LyKYTCevnqWrDle1LTBMlBF58RmCjSzM
# Unzip
unzip unimals_100.zip

Setup

We provide Dockerfile for easy installation and development. If you prefer to work without docker please take a look at Dockerfile and ensure that your local system has all the necessary dependencies installed.

Training

# Build docker container. Ensure that MuJoCo license is present: docker/mjkey.txt
./scripts/build_docker.sh
# Joint pre-training. Please change MOUNT_DIR location inside run_docker_gpu.sh
# Finally ensure that ENV.WALKER_DIR points to benchmark files and is accessible
# from docker.
./scripts/run_docker_gpu.sh python tools/train_ppo.py --cfg ./configs/ft.yaml

The default parameters assume that you are running the code on a machine with atlesat 1 GPU.

Citation

If you find this code useful, please consider citing:

@inproceedings{
    gupta2022metamorph,
    title={MetaMorph: Learning Universal Controllers with Transformers},
    author={Agrim Gupta and Linxi Fan and Surya Ganguli and Li Fei-Fei},
    booktitle={International Conference on Learning Representations},
    year={2022},
    url={https://openreview.net/forum?id=Opmqtk_GvYL}
}

Credit

This codebase would not have been possible without the following amazing open source codebases:

  1. ikostrikov/pytorch-a2c-ppo-acktr-gail
  2. hill-a/stable-baselines
  3. deepmind/dm_control
  4. openai/multi-agent-emergence-environments
You might also like...
[ICLR 2022] DAB-DETR: Dynamic Anchor Boxes are Better Queries for DETR
[ICLR 2022] DAB-DETR: Dynamic Anchor Boxes are Better Queries for DETR

DAB-DETR This is the official pytorch implementation of our ICLR 2022 paper DAB-DETR. Authors: Shilong Liu, Feng Li, Hao Zhang, Xiao Yang, Xianbiao Qi

[CVPR 2022] CoTTA Code for our CVPR 2022 paper Continual Test-Time Domain Adaptation

CoTTA Code for our CVPR 2022 paper Continual Test-Time Domain Adaptation Prerequisite Please create and activate the following conda envrionment. To r

The 7th edition of NTIRE: New Trends in Image Restoration and Enhancement workshop will be held on June 2022 in conjunction with CVPR 2022.
The 7th edition of NTIRE: New Trends in Image Restoration and Enhancement workshop will be held on June 2022 in conjunction with CVPR 2022.

NTIRE 2022 - Image Inpainting Challenge Important dates 2022.02.01: Release of train data (input and output images) and validation data (only input) 2

"MST++: Multi-stage Spectral-wise Transformer for Efficient Spectral Reconstruction" (CVPRW 2022) & (Winner of NTIRE 2022 Challenge on Spectral Reconstruction from RGB)

MST++: Multi-stage Spectral-wise Transformer for Efficient Spectral Reconstruction (CVPRW 2022) Yuanhao Cai, Jing Lin, Zudi Lin, Haoqian Wang, Yulun Z

PyTorch code for ICLR 2021 paper Unbiased Teacher for Semi-Supervised Object Detection
PyTorch code for ICLR 2021 paper Unbiased Teacher for Semi-Supervised Object Detection

Unbiased Teacher for Semi-Supervised Object Detection This is the PyTorch implementation of our paper: Unbiased Teacher for Semi-Supervised Object Detection

Code for ICLR 2021 Paper,
Code for ICLR 2021 Paper, "Anytime Sampling for Autoregressive Models via Ordered Autoencoding"

Anytime Autoregressive Model Anytime Sampling for Autoregressive Models via Ordered Autoencoding , ICLR 21 Yilun Xu, Yang Song, Sahaj Gara, Linyuan Go

Code for the paper
Code for the paper "Training GANs with Stronger Augmentations via Contrastive Discriminator" (ICLR 2021)

Training GANs with Stronger Augmentations via Contrastive Discriminator (ICLR 2021) This repository contains the code for reproducing the paper: Train

Official code for the ICLR 2021 paper Neural ODE Processes
Official code for the ICLR 2021 paper Neural ODE Processes

Neural ODE Processes Official code for the paper Neural ODE Processes (ICLR 2021). Abstract Neural Ordinary Differential Equations (NODEs) use a neura

Source code, datasets and trained models for the paper Learning Advanced Mathematical Computations from Examples (ICLR 2021), by François Charton, Amaury Hayat (ENPC-Rutgers) and Guillaume Lample

Maths from examples - Learning advanced mathematical computations from examples This is the source code and data sets relevant to the paper Learning a

Comments
  • `manifest for nvidia` error

    `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.

    opened by psh9002 1
  • Bug or bad usage?

    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.

    opened by Ericonaldo 1
Owner
Agrim Gupta
Agrim Gupta
The implementation of CVPR2021 paper Temporal Query Networks for Fine-grained Video Understanding, by Chuhan Zhang, Ankush Gupta and Andrew Zisserman.

Temporal Query Networks for Fine-grained Video Understanding ?? This repository contains the implementation of CVPR2021 paper Temporal_Query_Networks

null 55 Dec 21, 2022
Imposter-detector-2022 - HackED 2022 Team 3IQ - 2022 Imposter Detector

HackED 2022 Team 3IQ - 2022 Imposter Detector By Aneeljyot Alagh, Curtis Kan, Jo

Joshua Ji 3 Aug 20, 2022
ReLoss - Official implementation for paper "Relational Surrogate Loss Learning" ICLR 2022

Relational Surrogate Loss Learning (ReLoss) Official implementation for paper "R

Tao Huang 31 Nov 22, 2022
Anomaly Transformer: Time Series Anomaly Detection with Association Discrepancy" (ICLR 2022 Spotlight)

About Code release for Anomaly Transformer: Time Series Anomaly Detection with Association Discrepancy (ICLR 2022 Spotlight)

THUML @ Tsinghua University 221 Dec 31, 2022
[ICLR 2022] Pretraining Text Encoders with Adversarial Mixture of Training Signal Generators

AMOS This repository contains the scripts for fine-tuning AMOS pretrained models on GLUE and SQuAD 2.0 benchmarks. Paper: Pretraining Text Encoders wi

Microsoft 22 Sep 15, 2022
[ICLR 2022] Contact Points Discovery for Soft-Body Manipulations with Differentiable Physics

CPDeform Code and data for paper Contact Points Discovery for Soft-Body Manipulations with Differentiable Physics at ICLR 2022 (Spotlight). @InProceed

(Lester) Sizhe Li 29 Nov 29, 2022
Official Pytorch implementation of Online Continual Learning on Class Incremental Blurry Task Configuration with Anytime Inference (ICLR 2022)

The Official Implementation of CLIB (Continual Learning for i-Blurry) Online Continual Learning on Class Incremental Blurry Task Configuration with An

NAVER AI 34 Oct 26, 2022
[ICLR 2022 Oral] F8Net: Fixed-Point 8-bit Only Multiplication for Network Quantization

F8Net Fixed-Point 8-bit Only Multiplication for Network Quantization (ICLR 2022 Oral) OpenReview | arXiv | PDF | Model Zoo | BibTex PyTorch implementa

Snap Research 76 Dec 13, 2022
Implementation of GeoDiff: a Geometric Diffusion Model for Molecular Conformation Generation (ICLR 2022).

GeoDiff: a Geometric Diffusion Model for Molecular Conformation Generation [OpenReview] [arXiv] [Code] The official implementation of GeoDiff: A Geome

Minkai Xu 155 Dec 26, 2022
A PyTorch implementation of ICLR 2022 Oral paper PiCO: Contrastive Label Disambiguation for Partial Label Learning

PiCO: Contrastive Label Disambiguation for Partial Label Learning This is a PyTorch implementation of ICLR 2022 Oral paper PiCO; also see our Project

王皓波 83 May 11, 2022