Skip to content

Commit

Permalink
Add docker images + fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
araffin committed Oct 31, 2018
1 parent ba463f5 commit 70cc2c1
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[run]
branch = False
omit =
tests/

[report]
exclude_lines =
pragma: no cover
raise NotImplementedError()
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
__pycache__/
logs/
.pytest_cache/
.coverage
.coverage.*
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
- docker

install:
- docker pull araffin/stable-baselines-cpu
- docker pull araffin/rl-baselines-zoo-cpu

script:
- docker run --rm --network host --ipc=host --mount src=$(pwd),target=/root/code/stable-baselines,type=bind araffin/stable-baselines-cpu bash -c "cd /root/code/stable-baselines/ && pytest --cov-report term --cov=. -v tests/"
- docker run -it --rm --network host --ipc=host --mount src=$(pwd),target=/root/code/stable-baselines,type=bind araffin/rl-baselines-zoo-cpu bash -c "cd /root/code/stable-baselines/ && pytest --cov-config .coveragerc --cov-report term --cov=. -v tests/"
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[![Build Status](https://travis-ci.com/araffin/rl-baselines-zoo.svg?branch=master)](https://travis-ci.com/araffin/rl-baselines-zoo)

# RL Baselines Zoo: a Collection of Trained RL Agents

A collection of trained RL agents using [Stable Baselines](https://github.com/hill-a/stable-baselines).
A collection of trained RL agents, with tuned hyperparameters, using [Stable Baselines](https://github.com/hill-a/stable-baselines).

We are **looking for contributors** to complete the collection!

Expand Down Expand Up @@ -39,11 +41,21 @@ You can train agents online using [colab notebook](https://colab.research.google

```
apt-get install swig cmake libopenmpi-dev zlib1g-dev
pip install stable-baselines==2.1.1 box2d box2d-kengz
pip install stable-baselines==2.1.1 box2d box2d-kengz pyyaml
```

Please see [Stable Baselines README](https://github.com/hill-a/stable-baselines) for alternatives.

Build docker image (CPU):
```
docker build . -f docker/Dockerfile.cpu -t rl-baselines-zoo-cpu
```

Pull built docker image:
```
docker pull araffin/rl-baselines-zoo-cpu
```

## Contributing

If you trained an agent that is not present in the rl zoo, please submit a Pull Request (containing the hyperparameters and the score too).
28 changes: 28 additions & 0 deletions docker/Dockerfile.cpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM ubuntu:16.04

RUN apt-get -y update && \
apt-get -y install git wget python-dev python3-dev libopenmpi-dev \
python-pip libglib2.0-0 \
libsm6 libxext6 libfontconfig1 libxrender1 \
swig cmake libopenmpi-dev zlib1g-dev

ENV CODE_DIR /root/code
ENV VENV /root/venv

RUN \
pip install virtualenv && \
virtualenv $VENV --python=python3 && \
. $VENV/bin/activate && \
mkdir $CODE_DIR && \
cd $CODE_DIR && \
pip install --upgrade pip && \
pip install tensorflow==1.8.0 && \
pip install pytest==3.5.1 && \
pip install pytest-cov && \
pip install pyyaml && \
pip install box2d-py==2.3.5 && \
pip install stable-baselines==2.1.1

ENV PATH=$VENV/bin:$PATH

CMD /bin/bash
28 changes: 28 additions & 0 deletions docker/Dockerfile.gpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM nvidia/cuda:9.0-cudnn7-runtime-ubuntu16.04

RUN apt-get -y update && \
apt-get -y install git wget python-dev python3-dev libopenmpi-dev \
python-pip libglib2.0-0 \
libsm6 libxext6 libfontconfig1 libxrender1 \
swig cmake libopenmpi-dev zlib1g-dev

ENV CODE_DIR /root/code
ENV VENV /root/venv

RUN \
pip install virtualenv && \
virtualenv $VENV --python=python3 && \
. $VENV/bin/activate && \
mkdir $CODE_DIR && \
cd $CODE_DIR && \
pip install --upgrade pip && \
pip install tensorflow-gpu==1.8.0 && \
pip install pytest==3.5.1 && \
pip install pytest-cov && \
pip install pyyaml && \
pip install box2d-py==2.3.5 && \
pip install stable-baselines==2.1.1

ENV PATH=$VENV/bin:$PATH

CMD /bin/bash
3 changes: 2 additions & 1 deletion tests/test_train.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import glob
import subprocess
import shutil

import pytest

Expand All @@ -24,7 +25,7 @@ def _assert_eq(left, right):

# Clean up
if os.path.isdir(LOG_FOLDER):
os.remove(LOG_FOLDER)
shutil.rmtree(LOG_FOLDER)

@pytest.mark.parametrize("experiment", experiments.keys())
def test_enjoy(experiment):
Expand Down

0 comments on commit 70cc2c1

Please sign in to comment.