Skip to content

Commit

Permalink
final solution
Browse files Browse the repository at this point in the history
  • Loading branch information
gao-jianming committed Apr 1, 2024
1 parent 50684f6 commit 2364891
Show file tree
Hide file tree
Showing 16 changed files with 1,978 additions and 48 deletions.
50 changes: 44 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
![figure](https://neuralmmo.github.io/_static/banner.png)
# The Winning Solution for the NeurIPS 2023 Neural MMO Challenge

# ![icon](https://neuralmmo.github.io/_build/html/_images/icon.png) Welcome to the Platform!
This solution is based on the [Neural MMO Baselines](https://github.com/NeuralMMO/baselines/tree/2.0?tab=readme-ov-file). For more information about the challenge, please refer to the [challenge homepage](https://www.aicrowd.com/challenges/neurips-2023-the-neural-mmo-challenge).

[![](https://dcbadge.vercel.app/api/server/BkMmFUC?style=plastic)](https://discord.gg/BkMmFUC)
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40jsuarez5341)](https://twitter.com/jsuarez5341)
## How to Use

Baselines repository for Neural MMO. New users should treat this as a starter project. The project is under active development with [Documentation](https://neuralmmo.github.io "Neural MMO Documentation") hosted by github.io.
### Environment Installation
Use `docker/build.sh` to build image for training.
```shell
cd docker
bash build.sh
```

![figure](https://neuralmmo.github.io/_build/html/_images/poster.png)
### Run training
Run inside the training container:
```shell
export WANDB_API_KEY=xxx # Change it to yours
WANDB_PROJECT=xxx # Change it to yours
WANDB_ENTITY=xxx # Change it to yours

export WANDB_DISABLE_GIT=true
export WANDB_DISABLE_CODE=true

export OMP_NUM_THREADS=4

python train.py \
--runs-dir runs \
--use-ray-vecenv true \
--wandb-project $WANDB_PROJECT \
--wandb-entity $WANDB_ENTITY \
--model ReducedModelV2 \
--meander-bonus-weight 0.0 \
--heal-bonus-weight 0.0 \
--num-npcs 128 \
--early-stop-agent-num 0 \
--resilient-population 0.0 \
--ppo-update-epochs 1 \
--train-num-steps 40000000 \
--num-maps 1280 \
```

### Evaluation

After training, copy the checkpoints into `policies` and run:
```shell
python evaluate.py -p policies
```
`policies/submission.pkl` is the trained model we submitted.
10 changes: 10 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ARG DOCKER_BASE_IMAGE
FROM ${DOCKER_BASE_IMAGE}

COPY requirements.txt ./

RUN sudo rm /etc/apt/sources.list.d/* && sudo apt-get update && sudo apt-get install -y vim

RUN $HOME/anaconda3/bin/pip --no-cache-dir install -r requirements.txt

RUN sudo rm requirements.txt
5 changes: 5 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DOCKER_BASE_IMAGE="${DOCKER_BASE_IMAGE:-rayproject/ray:1.6.0-py39-gpu}"

docker build --no-cache \
--build-arg DOCKER_BASE_IMAGE=${DOCKER_BASE_IMAGE} \
-t ${DOCKER_BASE_IMAGE}-nmmo2023 .
4 changes: 4 additions & 0 deletions requirements.txt → docker/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ scikit-learn==1.3.0
tensorboard==2.11.2
tiktoken==0.4.0
torch==1.13.1
torchtyping==0.1.4
traitlets==5.9.0
transformers==4.31.0
wandb==0.13.7

nmmo==2.0.3
pufferlib==0.4.5
Loading

0 comments on commit 2364891

Please sign in to comment.