Coder Social home page Coder Social logo

loco-mujoco's Introduction

continous integration Documentation Status License: MIT PyPI

LocoMuJoCo is an imitation learning benchmark specifically targeted towards locomotion. It encompasses a diverse set of environments, including quadrupeds, bipeds, and musculoskeletal human models, each accompanied by comprehensive datasets, such as real noisy motion capture data, ground truth expert data, and ground truth sub-optimal data, enabling evaluation across a spectrum of difficulty levels.

LocoMuJoCo also allows you to specify your own reward function to use this benchmark for pure reinforcement learning! Checkout the example below!

Key Advantages

✅ Easy to use with Gymnasium or Mushroom-RL interface
✅ Many environments including humanoids and quadrupeds
✅ Diverse set of datasets --> e.g., noisy motion capture or ground truth datasets with actions
✅ Wide spectrum spectrum of difficulty levels
✅ Built-in domain randomization
✅ Many baseline algorithms for quick benchmarking
Documentation


Installation

You have the choice to install the latest release via PyPI by running

pip install loco-mujoco 

or you do an editable installation by cloning this repository and then running:

cd loco-mujoco
pip install -e . 

Download the Datasets

After installing LocoMuJoCo, new commands for downloading the datasets will be setup for you. You have the choice of downloading all datasets available or only the ones you need.

For example, to install all datasets run:

loco-mujoco-download

To install only the real (motion capture, no actions) datasets run:

loco-mujoco-download-real

To install only the perfect (ground-truth with actions) datasets run:

loco-mujoco-download-perfect

Installing the Baselines

If you also want to run the baselines, you have to install our imitation learning library imitation_lib. You find example files for training the baselines for any LocoMuJoCo task here.

First Test

To verify that everything is installed correctly, run the examples such as:

python examples/simple_mushroom_env/example_unitree_a1.py

To replay a dataset run:

python examples/replay_datasets/replay_Unitree.py

Environments & Tasks

You want a quick overview of all environments, tasks and datasets available? You can find it here and more detailed in the Documentation.

And stay tuned! There are many more to come ...


Quick Examples

LocoMuJoCo is very easy to use. Just choose and create the environment, and generate the dataset belonging to this task and you are ready to go!

import numpy as np
import loco_mujoco
import gymnasium as gym


env = gym.make("LocoMujoco", env_name="HumanoidTorque.run")
dataset = env.create_dataset()

You want to use LocoMuJoCo for pure reinforcement learning? No problem! Just define your custom reward function and pass it to the environment!

import numpy as np
import loco_mujoco
import gymnasium as gym
import numpy as np


def my_reward_function(state, action, next_state):
    return -np.mean(action)


env = gym.make("LocoMujoco", env_name="HumanoidTorque.run", reward_type="custom",
               reward_params=dict(reward_callback=my_reward_function))

LocoMuJoCo natively supports MushroomRL:

import numpy as np
from loco_mujoco import LocoEnv

env = LocoEnv.make("HumanoidTorque.run")
dataset = env.create_dataset()

You can find many more examples here.

Detailed Tutorials are given in the Documentation.


Citation

@inproceedings{alhafez2023b,
title={LocoMuJoCo: A Comprehensive Imitation Learning Benchmark for Locomotion},
author={Firas Al-Hafez and Guoping Zhao and Jan Peters and Davide Tateo},
booktitle={6th Robot Learning Workshop, NeurIPS},
year={2023}
}

Credits

Both Unitree models were taken from the MuJoCo menagerie

loco-mujoco's People

Contributors

eltociear avatar henritud avatar robfiras avatar

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.