• Stars
    star
    1,463
  • Rank 32,144 (Top 0.7 %)
  • Language
    Python
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Code for the paper "Neural MMO: A Massively Multiagent Game Environment for Training and Evaluating Intelligent Agents"

Status: Archive (code is provided as-is, no updates expected)

Neural MMO: A Massively Multiagent Game Environment for Training and Evaluating Intelligent Agents

(9/19) This is an archive of the inital release of the Neural MMO project. Active development continuing at jsuarez5341/neural-mmo. At the time of archiving, the project is on version 1.2 and has made significant progress since v1.0 -- here is a screenshot:

Neural MMO v1.0 Release

This environment is the first neural MMO; it attempts to create agents that scale to real world complexity. Simulating evolution on Earth is computationally infeasible, but we can construct a reasonable and efficient facsimile. We consider MMORPGs (Massive Multiplayer Online Role Playing Games) the best proxy for the real world among human games: they are complete macrocosms featuring thousands of agents per persistent world, diverse skilling systems, global economies, and ad-hoc high stakes single and team based conflict.

Quickstart

# Recommended Setup:
mkdir projekt
cd projekt

git clone https://github.com/jsuarez5341/neural-mmo-client
cd neural-mmo-client
bash setup.sh
cd ..

git clone https://github.com/openai/neural-mmo
cd neural-mmo
bash scripts/setup/setup.sh
python setup.py

This will download both the OpenAI environment and the independent client, which is required for rendering. Some setups may require you fix the symlink to the client (e.g. ln -s ../../neural-mmo-client/ embyr from forge/embyr). The setup file will only install external dependencies -- we assume you have already setup Anaconda with Python 3.6+. The environment is framework independently, but our experiment code does depend on PyTorch -- set this up separately.

Run the following, then navigate to http://localhost:8080/forge/embyr/ in Firefox or Chrome to pull up the renderer. Click to start and give it a few seconds to load assets and stabilize fps. For troubleshooting, see the Client Repo.

python Forge.py --render #Run the environment with rendering on

Overview

The project is divided into four modules:

Engineering Research
Blade: Env Trinity: API
Embyr: Render Ethyr: Neural

The objective is to create agents that scale to the complexity and robustness of the real world. This is a variant phrasing of "artificial life." A key perspective of the project is decoupling this statement into subproblems that are concrete, feasible, and directly composable to solve the whole problem. We split the objective into "agents that scale to their environment" and "environments that scale to the real world." These are large respective research and engineering problems, but unlike the original objective, they are specific enough to attempt individually. For a more thorough overview of the project approach and objective, see this Two Pager.

Research: Agents that scale to env complexity

Engineering: Env that scales to real world complexity

Trinity

Trinity is the native API for researchers (the naming is simply flavor -- see "Namesake" below). It consists of three base classes, Pantheon, God, and Sword, which you can override to execute code at the Cluster, Server, and Agent levels, respectively.

from forge.trinity import smith, Trinity, Pantheon, God, Sword
trinity = Trinity(Pantheon, God, Sword)
envs = smith.Native(config, args, trinity)
envs.run()

That's it -- all communications are handled internally. The provided Pantheon class includes sample gradient aggregation, optimization, and model saving code. The provided God class is mainly a stub to enable future work incorporating population level training algorithms. The provided Sword class contains our simple fully connected model. The full API is defined in forge/trinity/trinity.py.

The VecEnv/Gym computation model not well suited to this setting and performs 10-1000x more interprocess communication than is required. The native API is simpler, more efficient, and requires much less code. However, we do provide a canonical Gym API minimally modified to support a variable number of agents. Forge.py contains a complete forward pass example for a single population. Basic usage is:

from forge.trinity import smith
envs = smith.VecEnv(config, args, self.step)

#The environment is persistent: call reset only upon initialization
obs = envs.reset()

#Observations contain entity and stimulus
#for each agent in each environment.
actions = your_algorithm_here(obs)

#The environment is persistent: "dones" is always None
#If an observation is missing, that agent has died
obs, rewards, dones, infos = envs.step(actions)

You can try these both out with:

# Run Options:
python Forge.py --nRealm 2 --api native #Run 2 environments with native API
python Forge.py --nRealm 2 --api vecenv #Run 2 environments with vecenv API

Ethyr

Ethyr is the "contrib" for this project. It contains useful research tools for interacting with the project. I've seeded it with the helper classes for our experiments, including a model save/load manager, a rollout objects, and a basic optimizer. If you would like to contribute code (in any framework, not just PyTorch), please submit a pull request.

Blade

Blade is the core environment, including game state and control flow. Researchers should not need to touch this, outside perhaps importing core configurations and enums.

Embyr

Embyr is the independent THREE.js web client. This is downloaded from a separate repository in the setup above and symlinked to the OpenAI repository. You may have to fix the symbolic link if you get forge/embyr import errors. Again, researchers should not have to edit this. In order to run it, run Forge.py with --render enabled, then navigate to localhost:8080/forge/embyr in Firefox. It will take a couple seconds to initialize and load assets. You will need to refresh the page whenever you reboot the server (Forge.py). Chrome and Safari might work, but we do not currently offer official support.

Failure Modes

Evaluation can be somewhat difficult in our setting but is not a major blocker. For smaller experiments, we find population size and resource utilization to be reasonable metrics of success. For larger experiments with sufficient domain randomization, Tournaments (as described in the accompanying paper) allow for cross validation of approaches.

We are currently aware of three failure cases for the project:

  • Computational infeasibility
  • "Agents that scale to their environment" is too hard
  • "Environments that scale to the real world" is too hard

The first failure case is a serious risk, but is shared among all areas of the field. This project is not uniquely compute intensive -- in fact, it is one of few environments where it is straightforward to train reasonable policies on a single CPU. If scale is the main issue here, it is likely shared among most if not all other approaches.

The second problem is probably most familiar to researchers as exploration. Given a cold start, how can agents bootstrap both to better policies and to better exploration strategies? This is a hard problem, but it is unlikely to kill the project because:

  • This is independently an important problem that many researchers are already working on already
  • The environment of this project is designed collaboratively to assist agents early on in learning, rather than adversarially as a hard benchmark
  • Recent projects have demonstrated success at scale.

The third problem probably appears most likely to many researchers, but least likely to anyone who has spent a significant amount of time in MMOs. Here is a map of the NYC subway:

QuestMap Source

Actually, it's a quest map of Runescape, a particular MMO that our environment is loosely based upon. Each quest is a puzzle in itself, takes anywhere from several minutes to several hours to complete, is part of an interconnected web of prerequisites of other quests, and provides different incentives for completion ranging from equipment to unlockable content to experience in a tightly connected set of skills:

Skills Equipment Source

In a massive open world:

GameMap Source

The most complex class of games considered to date is MOBAs (Massive Online Battle Arenas, e.g. Dota, Quake CTF), which are round based, take on order of an hour, and are mechanically intensive. Achieving 99 in all skills and acquiring the best gear in Runescape takes, at minimum, several thousand hours. In a tournament setting where attacking other players is allowed everywhere, moment-to-moment gameplay is less important than balancing the risks and rewards of any potential strategy--especially in the presence of hundreds of other players attempting to do the same. There is almost certainly still a complexity gap from MMOs to the real world, but we believe it is much smaller than that in environments currently available.

While our environment is nowhere near the level of complexity of a real MMO yet, it does contain key properties of persistence, population scale, and open-endedness. As agents begin to reach the ceiling of the current environment, we plan on continuing development to raise the ceiling.

File Structure

/forge/trinity ~350 lines

  • /forge/trinity/ann.py - Defines architectures
  • /forge/trinity/god.py - Defines server level code (e.g. entity tagging)
  • /forge/trinity/pantheon.py - Defines cluster level code (e.g. gradient averaging)
  • /forge/trinity/sword.py - Defines core level code (e.g. running networks, collecting rollouts, computing gradients)
  • /forge/trinity/trinity.py - Wraps a pantheon, god, and sword
  • /forge/trinity/smith.py - Defines the Native and VecEnv / Gym APIs

/forge/ethyr ~250 lines

  • /forge/ethyr/rollouts.py - Collects and merges rollouts
  • /forge/ethyr/stim.py - Produces a stimulus from local game state
  • /forge/ethyr/torch - pytorch specific neural utilities
    • /forge/ethyr/torch/loss.py - Defines policy/value loss and advantage
    • /forge/ethyr/torch/optim.py - Defines optimization and gradient computation
    • /forge/ethyr/torch/param.py - Network surgery useful for serialization
    • /forge/ethyr/torch/stim.py - Wraps the generic stimulus library with pytorch tensors
    • /forge/ethyr/torch/utils.py - Generic pytorch tools

/forge/blade ~2k lines, of which >1k are for future expansion. Only italicized files are relevant.

  • /forge/blade/action - Defines what entities can do, what occurs when they do it, and provides structure for reasoning over actions.
    • /forge/blade/action/action.py - Class stubs for each action
    • /forge/blade/action/tree.py - Tree structure for assembling actions (e.g. action -> sub-action -> args)
    • /forge/blade/action/v2.py - Actions that entities can select, instantiate, and .call() to directly modify world state
  • /forge/blade/core — Contains ~500 lines of state and game loop code.
    • /forge/blade/core/config.py - Defines specifications for each test environment, including entity statistics, the map, and spawn locations.
    • /forge/blade/core/tile.py - Defines an individual game tile
    • /forge/blade/core/map.py - Defines a map of game tiles
    • /forge/blade/core/env.py - Wraps the full game state
    • /forge/blade/core/realm.py - Defines the game loop updating the environment and agents.
  • /forge/blade/entity - Defines agents, both neural and scripted
    • /forge/blade/entity/player.py — Defines "player" state
    • /forge/blade/entity/npc/
      • /forge/blade/entity/npc/npc.py — This defines client state (e.g. wraps the neural net making decisions)
      • /forge/blade/entity/npc/mobs.py - Defines scripted npcs
  • /forge/blade/hook - Defines startup scripts that preassemble references
  • /forge/blade/item - Defines all items in the game, including equipment
  • /forge/blade/lib - Defines generic utilities that either do not have clean python implementations or require specific changes for the project
  • /forge/blade/systems - Defines game content

/forge/embyr See Client Repo

Namesake

In formal publications, we refer to our project as simply a "Neural MMO." Internally and informally, we call it "Projekt: Godsword." The name comes from two sources: CD Projekt Red, my personal favorite game dev studio, and OldSchool Runescape, which contains an iconic set of weapons called god swords. The latter is a particularly good model for AI environments; the former is more of a soft flavor inspiration.

Authorship

I, Joseph Suarez, am the author of the core code base. Yilun Du assisted with running experiments and particularly in setting up tournaments. Phillip Isola and Igor Mordatch have been invaluable collaborators and advisers throughout the project. The client was developed independently as a collaboration between myself and Clare Zhu.

License & Assets

The OpenAI repository is open sourced under the MIT License. There is a smaller original code base and game kernel that I (Joseph Suarez) retain ownership of, along with associated ideas. I created these before my employment -- the initial commit here represents the latest pre-employment timestep.

Some assets used in this project belong to Jagex , the creators of Runescape, such as

Alt text Alt text Alt text Alt text Alt text

We currently use them for flavor as an homage to the game that inspired the project. We believe these fall under fair use as a not-for-profit project for the advancement of artificial intelligence research -- however, we are more than happy to remove them upon request. We do own the 2D and 3D files for agents.

Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text

More Repositories

1

whisper

Robust Speech Recognition via Large-Scale Weak Supervision
Python
62,693
star
2

openai-cookbook

Examples and guides for using the OpenAI API
MDX
58,610
star
3

gym

A toolkit for developing and comparing reinforcement learning algorithms.
Python
34,442
star
4

CLIP

CLIP (Contrastive Language-Image Pretraining), Predict the most relevant text snippet given an image
Jupyter Notebook
22,966
star
5

openai-python

The official Python library for the OpenAI API
Python
22,561
star
6

gpt-2

Code for the paper "Language Models are Unsupervised Multitask Learners"
Python
21,450
star
7

chatgpt-retrieval-plugin

The ChatGPT Retrieval Plugin lets you easily find personal or work documents by asking questions in natural language.
Python
21,032
star
8

baselines

OpenAI Baselines: high-quality implementations of reinforcement learning algorithms
Python
15,622
star
9

gpt-3

GPT-3: Language Models are Few-Shot Learners
15,573
star
10

swarm

Educational framework exploring ergonomic, lightweight multi-agent orchestration. Managed by OpenAI Solution team.
Python
14,944
star
11

evals

Evals is a framework for evaluating LLMs and LLM systems, and an open-source registry of benchmarks.
Python
14,607
star
12

tiktoken

tiktoken is a fast BPE tokeniser for use with OpenAI's models.
Python
11,374
star
13

triton

Development repository for the Triton language and compiler
C++
11,077
star
14

DALL-E

PyTorch package for the discrete VAE used for DALL·E.
Python
10,760
star
15

shap-e

Generate 3D objects conditioned on text or images
Python
10,285
star
16

spinningup

An educational resource to help anyone learn deep reinforcement learning.
Python
8,587
star
17

openai-node

The official Node.js / Typescript library for the OpenAI API
TypeScript
7,703
star
18

universe

Universe: a software platform for measuring and training an AI's general intelligence across the world's supply of games, websites and other applications.
Python
7,385
star
19

jukebox

Code for the paper "Jukebox: A Generative Model for Music"
Python
7,326
star
20

point-e

Point cloud diffusion for 3D model synthesis
Python
5,777
star
21

consistency_models

Official repo for consistency models.
Python
5,725
star
22

guided-diffusion

Python
5,000
star
23

plugins-quickstart

Get a ChatGPT plugin up and running in under 5 minutes!
Python
4,133
star
24

transformer-debugger

Python
4,003
star
25

retro

Retro Games in Gym
C
3,361
star
26

glide-text2im

GLIDE: a diffusion-based text-conditional image synthesis model
Python
3,277
star
27

glow

Code for reproducing results in "Glow: Generative Flow with Invertible 1x1 Convolutions"
Python
3,016
star
28

mujoco-py

MuJoCo is a physics engine for detailed, efficient rigid body simulations with contacts. mujoco-py allows using MuJoCo from Python 3.
Cython
2,586
star
29

openai-quickstart-node

Node.js example app from the OpenAI API quickstart tutorial
JavaScript
2,534
star
30

weak-to-strong

Python
2,445
star
31

improved-gan

Code for the paper "Improved Techniques for Training GANs"
Python
2,218
star
32

human-eval

Code for the paper "Evaluating Large Language Models Trained on Code"
Python
2,204
star
33

improved-diffusion

Release for Improved Denoising Diffusion Probabilistic Models
Python
2,102
star
34

roboschool

DEPRECATED: Open-source software for robot simulation, integrated with OpenAI Gym.
Python
2,064
star
35

image-gpt

Python
2,025
star
36

consistencydecoder

Consistency Distilled Diff VAE
Python
1,933
star
37

finetune-transformer-lm

Code and model for the paper "Improving Language Understanding by Generative Pre-Training"
Python
1,929
star
38

gpt-2-output-dataset

Dataset of GPT-2 outputs for research in detection, biases, and more
Python
1,908
star
39

multiagent-particle-envs

Code for a multi-agent particle environment used in the paper "Multi-Agent Actor-Critic for Mixed Cooperative-Competitive Environments"
Python
1,871
star
40

pixel-cnn

Code for the paper "PixelCNN++: A PixelCNN Implementation with Discretized Logistic Mixture Likelihood and Other Modifications"
Python
1,856
star
41

openai-quickstart-python

Python example app from the OpenAI API quickstart tutorial
1,685
star
42

requests-for-research

A living collection of deep learning problems
HTML
1,625
star
43

multi-agent-emergence-environments

Environment generation code for the paper "Emergent Tool Use From Multi-Agent Autocurricula"
Python
1,590
star
44

gpt-discord-bot

Example Discord bot written in Python that uses the completions API to have conversations with the `text-davinci-003` model, and the moderations API to filter the messages.
Python
1,569
star
45

evolution-strategies-starter

Code for the paper "Evolution Strategies as a Scalable Alternative to Reinforcement Learning"
Python
1,504
star
46

generating-reviews-discovering-sentiment

Code for "Learning to Generate Reviews and Discovering Sentiment"
Python
1,491
star
47

prm800k

800,000 step-level correctness labels on LLM solutions to MATH problems
Python
1,371
star
48

openai-dotnet

The official .NET library for the OpenAI API
C#
1,352
star
49

openai-assistants-quickstart

OpenAI Assistants API quickstart with Next.js.
TypeScript
1,350
star
50

sparse_attention

Examples of using sparse attention, as in "Generating Long Sequences with Sparse Transformers"
Python
1,347
star
51

maddpg

Code for the MADDPG algorithm from the paper "Multi-Agent Actor-Critic for Mixed Cooperative-Competitive Environments"
Python
1,284
star
52

Video-Pre-Training

Video PreTraining (VPT): Learning to Act by Watching Unlabeled Online Videos
Python
1,280
star
53

openai-openapi

OpenAPI specification for the OpenAI API
1,235
star
54

lm-human-preferences

Code for the paper Fine-Tuning Language Models from Human Preferences
Python
1,185
star
55

following-instructions-human-feedback

1,129
star
56

universe-starter-agent

A starter agent that can solve a number of universe environments.
Python
1,086
star
57

dalle-2-preview

1,044
star
58

InfoGAN

Code for reproducing key results in the paper "InfoGAN: Interpretable Representation Learning by Information Maximizing Generative Adversarial Nets"
Python
1,029
star
59

grade-school-math

Python
1,005
star
60

procgen

Procgen Benchmark: Procedurally-Generated Game-Like Gym-Environments
C++
1,005
star
61

supervised-reptile

Code for the paper "On First-Order Meta-Learning Algorithms"
JavaScript
955
star
62

blocksparse

Efficient GPU kernels for block-sparse matrix multiplication and convolution
Cuda
941
star
63

automated-interpretability

Python
896
star
64

random-network-distillation

Code for the paper "Exploration by Random Network Distillation"
Python
861
star
65

kubernetes-ec2-autoscaler

A batch-optimized scaling manager for Kubernetes
Python
849
star
66

summarize-from-feedback

Code for "Learning to summarize from human feedback"
Python
833
star
67

large-scale-curiosity

Code for the paper "Large-Scale Study of Curiosity-Driven Learning"
Python
800
star
68

multiagent-competition

Code for the paper "Emergent Complexity via Multi-agent Competition"
Python
761
star
69

imitation

Code for the paper "Generative Adversarial Imitation Learning"
Python
643
star
70

deeptype

Code for the paper "DeepType: Multilingual Entity Linking by Neural Type System Evolution"
Python
633
star
71

mlsh

Code for the paper "Meta-Learning Shared Hierarchies"
Python
588
star
72

iaf

Code for reproducing key results in the paper "Improving Variational Inference with Inverse Autoregressive Flow"
Python
499
star
73

mujoco-worldgen

Automatic object XML generation for Mujoco
Python
489
star
74

safety-gym

Tools for accelerating safe exploration research.
Python
421
star
75

vdvae

Repository for the paper "Very Deep VAEs Generalize Autoregressive Models and Can Outperform Them on Images"
Python
407
star
76

coinrun

Code for the paper "Quantifying Transfer in Reinforcement Learning"
C++
390
star
77

robogym

Robotics Gym Environments
Python
389
star
78

weightnorm

Example code for Weight Normalization, from "Weight Normalization: A Simple Reparameterization to Accelerate Training of Deep Neural Networks"
Python
357
star
79

atari-py

A packaged and slightly-modified version of https://github.com/bbitmaster/ale_python_interface
C++
354
star
80

openai-security-bots

Python
351
star
81

openai-gemm

Open single and half precision gemm implementations
C
335
star
82

vime

Code for the paper "Curiosity-driven Exploration in Deep Reinforcement Learning via Bayesian Neural Networks"
Python
331
star
83

safety-starter-agents

Basic constrained RL agents used in experiments for the "Benchmarking Safe Exploration in Deep Reinforcement Learning" paper.
Python
312
star
84

ebm_code_release

Code for Implicit Generation and Generalization with Energy Based Models
Python
311
star
85

CLIP-featurevis

code for reproducing some of the diagrams in the paper "Multimodal Neurons in Artificial Neural Networks"
Python
294
star
86

gym-http-api

API to access OpenAI Gym from other languages via HTTP
Python
292
star
87

gym-soccer

Python
289
star
88

sparse_autoencoder

Python
287
star
89

robosumo

Code for the paper "Continuous Adaptation via Meta-Learning in Nonstationary and Competitive Environments"
Python
283
star
90

web-crawl-q-and-a-example

Learn how to crawl your website and build a Q/A bot with the OpenAI API
Jupyter Notebook
268
star
91

phasic-policy-gradient

Code for the paper "Phasic Policy Gradient"
Python
245
star
92

EPG

Code for the paper "Evolved Policy Gradients"
Python
240
star
93

orrb

Code for the paper "OpenAI Remote Rendering Backend"
C#
235
star
94

miniF2F

Formal to Formal Mathematics Benchmark
Objective-C++
202
star
95

atari-reset

Code for the blog post "Learning Montezuma’s Revenge from a Single Demonstration"
Python
183
star
96

spinningup-workshop

For educational materials related to the spinning up workshops.
TeX
181
star
97

train-procgen

Code for the paper "Leveraging Procedural Generation to Benchmark Reinforcement Learning"
Python
170
star
98

human-eval-infilling

Code for the paper "Efficient Training of Language Models to Fill in the Middle"
Python
162
star
99

openai-go

The official Go library for the OpenAI API
Go
145
star
100

dallify-discord-bot

Example code for using OpenAI’s NodeJS SDK with discord.js SDK to create a Discord Bot that uses Slash Commands.
TypeScript
139
star