Skip to content

Commit

Permalink
Final Project
Browse files Browse the repository at this point in the history
  • Loading branch information
ksairos authored and ksairos committed Jun 22, 2024
0 parents commit 3a9c50f
Show file tree
Hide file tree
Showing 2,185 changed files with 1,894,748 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Container base image
# PyTorch image with Python 3.9
ARG BASE_IMAGE="pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime"
FROM ${BASE_IMAGE}

# Set display variable to enable rendering through system X server.
# Display and rendering only works with running X server.
ENV DISPLAY=host.docker.internal:0.0

# Update and upgrade standard stuff
RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install software-properties-common -y && \
add-apt-repository -y multiverse && apt-get update -y && apt-get upgrade -y && \
apt-get install -y apt-utils nano vim man build-essential wget sudo && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update -y && apt-get install -y curl libssl-dev openssl libopenblas-dev \
libhdf5-dev hdf5-helpers hdf5-tools libhdf5-serial-dev libprotobuf-dev protobuf-compiler git

# Enable opengl to show OpenGL based rendering of environments
RUN apt-get update -y && apt-get install -y python-opengl

# Install GPUtil for GPU system monitoring via ray
RUN pip install GPUtil
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "dev-container-MARLlib",

// Use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
// Path is relative to the devcontainer.json file.
"dockerfile": "Dockerfile"
},

// An array of Docker CLI arguments that should be used when running the container
"runArgs": [
// Use available GPUs
"--gpus","all",
"--shm-size","16gb" //Make sure to set this to more than 30% of available RAM.
],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh",

// Connect as root. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "root"
}
12 changes: 12 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# Install MARLlib as editable python package
cd /workspaces/MARLlib && pip install -e .

# Install specific protobuf version to fix ray 1.8 protobuf bug
# TODO - remove when upgrading dependencies
# BUG - tensorboardx probably not working as expected due to this temporary fix
pip install protobuf==3.20

# Install dependencies for test suite
pip install pytest pytest-cov
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Upload Python Package

on:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: test

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.8"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install packages
run: |
python -m pip install --upgrade pip
# pip install setuptools==65.5.0
# pip install pytest-cov
# pip install gym==0.21.0
# pip install ray==1.8.0
# pip install ray[tune]
# pip install ray[rllib]
# pip install torch==1.9.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
# pip install icecream==2.1.3
# pip install pettingzoo==1.12.0
# pip install pettingzoo[mpe]
# pip install supersuit==3.2.0
# pip install numpy==1.20.3
# pip install importlib-metadata==4.13.0
# pip install -e .
# - name: Unit tests
# run: |
# mkdir -p test_data
# pytest tests/test_base.py
162 changes: 162 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
.idea/*

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
42 changes: 42 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## General guidelines

To contribute, fork the repository and send a pull request.

When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible.

Where appropriate, please provide unit tests or integration tests. Unit tests should be pytest based tests and be added to `<project>/tests`.

Please make sure all tests pass before submitting a pull request. It is also good if you squash your commits and add the tags `#major` or `#minor` to the pull request title if need be, otherwise your pull request will be considered a patch bump.

## Contributing to MARLlib

We welcome contributions to MARLlib! If you're interested in contributing, here are some areas where we would appreciate your help:

### New Tasks

MARLlib aims to support a wide range of multi-agent reinforcement learning tasks. If you have a new task in mind that you think would be valuable to include, please consider contributing its implementation. You can add the new task code under the `marllib/envs` directory.

### New Algorithms

We are always looking to expand the collection of algorithms available in MARLlib. If you have developed a new multi-agent RL algorithm or would like to implement an existing one that is missing, we encourage you to contribute. You can add the new algorithm code under the `/marllib/marl/algos` directory.

### Bug fixes and enhancements

Contributions to fix bugs or enhance the existing functionality of MARLlib are highly appreciated. If you come across any issues or have ideas for improvements, please feel free to contribute your changes. You can submit bug fixes and enhancements as pull requests to the repository.

We appreciate all contributions and will review them promptly. Thank you for your interest in improving MARLlib!


## Testing the code locally

To test the code locally you need to install the dependencies for the library in the current environment. Additionally, you need to install the dependencies for testing. All of those dependencies can be installed with:

```
pip install -e .
```

To run the tests simply execute:

```
pytest -v --cov=marllib --cov-report html
```
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Replicable-MARL

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include VERSION.txt
include LICENSE
include requirements.txt
include README.md
Loading

0 comments on commit 3a9c50f

Please sign in to comment.