Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate winner solutions, puffer 0.7, and syllabus #26

Merged
merged 69 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
0479f9c
upgrade to puf07 and simplify
kywch Feb 17, 2024
cc5240e
switched to nmmo mg ver
kywch Feb 27, 2024
5a96786
use agent training minigame
kywch Feb 27, 2024
72e9856
speed up postproc
kywch Feb 29, 2024
9a3d5dd
renamed run.py to train.py, tested historical self-play
kywch Mar 3, 2024
45055c0
ported evaluate
kywch Mar 4, 2024
6785d28
tweaked train config
kywch Mar 4, 2024
449c529
quick fixes
kywch Mar 5, 2024
66dea2a
added recurrent to policy using puffer
kywch Mar 5, 2024
5ceade5
postproc reward clean up
kywch Mar 5, 2024
513243c
made npcs weaker
kywch Mar 5, 2024
35a1df1
correct debug flag
kywch Mar 5, 2024
95d0fce
game balacing tweak
kywch Mar 5, 2024
7934daf
game balacing tweak
kywch Mar 5, 2024
a7b83ec
game balacing tweak
kywch Mar 5, 2024
2ea6add
assume all policies are recurrent going forward
kywch Mar 6, 2024
eb17123
enabled torch compile
kywch Mar 7, 2024
24656bc
made postprocessor as an env wrapper
kywch Mar 8, 2024
6891748
fixed stat wrapper agents
kywch Mar 8, 2024
9709bfc
log name tweak
kywch Mar 8, 2024
68c3750
removed post processors
kywch Mar 11, 2024
7b164ec
added eval tasks, task-conditioning exp
kywch Mar 26, 2024
5f88bb4
renamed reward wrapper, fixed errors
kywch Mar 27, 2024
0b6014d
process task-conditioning results
kywch Mar 27, 2024
d6d7188
created analysis dir
kywch Mar 27, 2024
e4c7628
updated analysis script
kywch Mar 27, 2024
46a8d48
error fix
kywch Mar 27, 2024
47eccbe
switched to pyproject.toml, applied ruff
kywch Mar 28, 2024
7322f5f
unpin torch
kywch Mar 28, 2024
02fb486
quick fixes
kywch Mar 28, 2024
942da4d
tweak slurm scripts
kywch Mar 29, 2024
622a7f7
added temp no death rew
kywch Apr 2, 2024
053d46a
added yaofeng model
kywch Apr 5, 2024
b505230
tweaked yaofeng config
kywch Apr 5, 2024
d029956
ported takeru model
kywch Apr 6, 2024
6e08c06
added donot attack npc to takeru
kywch Apr 6, 2024
627182b
revert back to org cfg
kywch Apr 6, 2024
eb94d63
agent mix and match
kywch Apr 6, 2024
1dff5a8
updated eval task file
kywch Apr 10, 2024
01999a5
upload trained models
kywch Apr 11, 2024
382129a
clean up env cfg
kywch Apr 16, 2024
69194d5
clean up env
kywch Apr 16, 2024
e9887a0
Add Syllabus code
RyanNavillus Apr 17, 2024
7ccce0b
Fix integration issues so code runs
RyanNavillus Apr 17, 2024
814c0d7
Cleanup
RyanNavillus Apr 17, 2024
05d1bcc
Merge branch 'puf07-nmmomg' of https://github.com/CarperAI/nmmo-basel…
RyanNavillus Apr 17, 2024
41dfec0
Fix merge
RyanNavillus Apr 17, 2024
1195589
Remove config changes
RyanNavillus Apr 17, 2024
b11b523
Merge pull request #79 from RyanNavillus/puf07-nmmomg
kywch Apr 17, 2024
1938d16
edited syllabus, checked deps
kywch Apr 18, 2024
acf7596
add syllabus to wandb log
kywch Apr 18, 2024
89859d5
add syllabus wandb logging
kywch Apr 18, 2024
4ed5af1
added use custom rew flag
kywch Apr 18, 2024
b860eec
tweak syllabus tasks
kywch Apr 18, 2024
de6a30e
tweak syllabus cond
kywch Apr 18, 2024
9ef8847
tweaked syllabus tasks
kywch Apr 18, 2024
4550272
tweaked syllabus tasks
kywch Apr 19, 2024
7f7c928
tweaked syllabus tasks
kywch Apr 19, 2024
83438ab
tweaked syllabus tasks
kywch Apr 19, 2024
0c99fb3
Create README.md
kywch Apr 23, 2024
138567d
Delete agent_zoo/takeru/submitted_env.py
kywch Apr 23, 2024
8ca53ff
Update README.md
kywch Apr 23, 2024
9130265
updated readme
kywch May 31, 2024
465714d
Merge branch 'puf07-nmmomg' of github.com:CarperAI/nmmo-baselines int…
kywch May 31, 2024
d432e65
Update README.md
kywch May 31, 2024
20202aa
use nmmo pip
kywch Jul 29, 2024
1936a7b
pip pufferlib
kywch Jul 29, 2024
6463d3b
adjust dep vers
kywch Jul 29, 2024
0fe4872
Merge branch '2.1' into puf07-nmmomg
jsuarez5341 Jul 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions .github/workflows/pylint-test.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: tox
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
py: ["3.8", "3.9", "3.10"]
steps:
- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- uses: actions/checkout@v3
- name: Upgrade pip
run: python -m pip install -U pip setuptools wheel cython
- name: Install
run: python -m pip install -e '.[dev]'
- name: Check formatting
run: ruff format .
- name: Check lint
run: ruff check .
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.2
hooks:
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format
36 changes: 0 additions & 36 deletions .pylintrc

This file was deleted.

62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,65 @@ Baselines for Neural MMO (neuralmmo.github.io) -- new users should treat this re
</a>

[Documentation](https://neuralmmo.github.io "Neural MMO Documentation") is hosted by github.io.

## Installation

After cloning this repo, run:

```
pip install -e .[dev]
```

## Training

To test if the installation was successful (with the `--debug` mode), run the following command:

```
python train.py --debug --no-track
```

To log the training process, edit the wandb section in `config.yaml` and remove `--no-track` from the command line. The `config.yaml` file contains various configuration settings for the project.

### Agent zoo and your custom policy

This baseline comes with four different models under the `agent_zoo` directory: `neurips23_start_kit`, `yaofeng`, `takeru`, and `hybrid`. You can use any of these models by specifying the `-a` argument.

```
python train.py -a hybrid
```

You can also create your own policy by creating a new module under the `agent_zoo` directory, which should contain `Policy`, `Recurrent`, and `RewardWrapper` classes.

### Curriculum Learning using Syllabus

The training script supports automatic curriculum learning using the [Syllabus](https://github.com/RyanNavillus/Syllabus) library. To use it, add `--syllabus` to the command line.

```
python train.py --syllabus
```

## Replay generation

The `policies` directory contains a set of trained policies. For your models, create a directory and copy the checkpoint files to it. To generate a replay, run the following command:

```
python train.py -m replay -p policies
```

The replay file ends with `.replay.lzma`. You can view the replay using the [web viewer](https://kywch.github.io/nmmo-client/).

## Evaluation

The evaluation script supports the pvp and pve modes. The pve mode spawns all agents using only one policy. The pvp mode spawns groups of agents, each controlled by a different policy.

To evaluate models in the `policies` directory, run the following command:

```
python evaluate.py policies pvp -r 10
```

This generates 10 results json files in the same directory (by using `-r 10`), each of which contains the results from 200 episodes. Then the task completion metrics can be viewed using:

```
python analysis/proc_eval_result.py policies
```
Empty file added agent_zoo/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions agent_zoo/hybrid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ruff: noqa
from .takeru import Policy
from .takeru import Recurrent
from .yaofeng import RewardWrapper
3 changes: 3 additions & 0 deletions agent_zoo/neurips23_start_kit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .baseline_policy import Baseline as Policy
from .baseline_policy import Recurrent
from .reward_wrapper import RewardWrapper
Loading