HumanCompatibleAI / overcooked_ai

A benchmark environment for fully cooperative human-AI performance.
https://arxiv.org/abs/1910.05789
MIT License
714 stars 152 forks source link
artificial-intelligence deep-learning machine-learning pytorch reinforcement-learning

MDP python tests overcooked-ai codecov PyPI version "Open Issues" GitHub issues by-label Downloads arXiv

Overcooked-AI 🧑‍🍳🤖

5 of the available layouts. New layouts are easy to hardcode or generate programmatically.

Introduction 🥘

Overcooked-AI is a benchmark environment for fully cooperative human-AI task performance, based on the wildly popular video game Overcooked.

The goal of the game is to deliver soups as fast as possible. Each soup requires placing up to 3 ingredients in a pot, waiting for the soup to cook, and then having an agent pick up the soup and delivering it. The agents should split up tasks on the fly and coordinate effectively in order to achieve high reward.

You can try out the game here (playing with some previously trained DRL agents). To play with your own trained agents using this interface, or to collect more human-AI or human-human data, you can use the code here. You can find some human-human and human-AI gameplay data already collected here.

DRL implementations compatible with the environment are included in the repo as a submodule under src/human_aware_rl.

The old human_aware_rl is being deprecated and should only used to reproduce the results in the 2019 paper: On the Utility of Learning about Humans for Human-AI Coordination (also see our blog post).

For simple usage of the environment, it's worthwhile considering using this environment wrapper.

Research Papers using Overcooked-AI 📑

Installation ☑️

Installing from PyPI 🗜

You can install the pre-compiled wheel file using pip.

pip install overcooked-ai

Note that PyPI releases are stable but infrequent. For the most up-to-date development features, build from source with pip install -e ..

Building from source 🔧

It is useful to setup a conda environment with Python 3.7 (virtualenv works too):

conda create -n overcooked_ai python=3.7
conda activate overcooked_ai

Clone the repo

git clone https://github.com/HumanCompatibleAI/overcooked_ai.git

Finally, use python setup-tools to locally install

If you just want to use the environment:

pip install -e .

If you also need the DRL implementations (you may have to input this in your terminal as pip install -e '.[harl]'):

pip install -e .[harl]

Verifying Installation 📈

When building from source, you can verify the installation by running the Overcooked unit test suite. The following commands should all be run from the overcooked_ai project root directory:

python testing/overcooked_test.py

To check whether the humam_aware_rl is installed correctly, you can run the following command from the src/human_aware_rl directory:

$ ./run_tests.sh

⚠️Be sure to change your CWD to the human_aware_rl directory before running the script, as the test script uses the CWD to dynamically generate a path to save temporary training runs/checkpoints. The testing script will fail if not being run from the correct directory.

This will run all tests belonging to the human_aware_rl module. You can checkout the README in the submodule for instructions of running target-specific tests. This can be initiated from any directory.

If you're thinking of using the planning code extensively, you should run the full testing suite that verifies all of the Overcooked accessory tools (this can take 5-10 mins):

python -m unittest discover -s testing/ -p "*_test.py"

Code Structure Overview 🗺

overcooked_ai_py contains:

mdp/:

agents/:

planning/:

human_aware_rl contains:

ppo/:

rllib/:

imitation/:

human/:

utils.py: utils for the repo

overcooked_demo contains:

server/:

up.sh: Shell script to spin up the Docker server that hosts the game

Python Visualizations 🌠

See this Google Colab for some sample code for visualizing trajectories in python.

We have incorporated a notebook that guides users on the process of training, loading, and evaluating agents. Ideally, we would like to enable users to execute the notebook in Google Colab; however, due to Colab's default kernel being Python 3.10 and our repository being optimized for Python 3.7, some functions are presently incompatible with Colab. To provide a seamless experience, we have pre-executed all the cells in the notebook, allowing you to view the expected output when running it locally following the appropriate setup.

Overcooked_demo can also start an interactive game in the browser for visualizations. Details can be found in its README

Raw Data :ledger:

The raw data used in training is >100 MB, which makes it inconvenient to distribute via git. The code uses pickled dataframes for training and testing, but in case one needs to original data it can be found here

Further Issues and questions ❓

If you have issues or questions, you can contact Micah Carroll at mdc@berkeley.edu.