Skip to content

Commit

Permalink
Add Gitlab CI (#12)
Browse files Browse the repository at this point in the history
* Test gitlab-ci

* Try different image

* Add pytest and doc build

* Fix command

* Fix image used for CI

* Seperate pytest builds

* Fix weird seg fault in docker image due to FakeImageEnv

* Fix make command

* [ci skip] Add space in the badges

* Fix CI failures

* Re-install opencv

* Use opencv-headless

* Test with new docker image
  • Loading branch information
araffin committed May 9, 2020
1 parent a06c4a7 commit 257a40e
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
14 changes: 14 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
image: stablebaselines/stable-baselines3-cpu:0.6.0a7

type-check:
script:
- make type

pytest:
script:
# MKL_THREADING_LAYER=GNU to avoid MKL_THREADING_LAYER=INTEL incompatibility error
- MKL_THREADING_LAYER=GNU make pytest

doc-build:
script:
- make doc
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ COPY ./stable_baselines3/version.txt ${CODE_DIR}/stable-baselines3/stable_baseli
RUN \
cd ${CODE_DIR}/stable-baselines3 3&& \
pip install -e .[extra,tests,docs] && \
# Use headless version for docker
pip install opencv-python-headless && \
rm -rf $HOME/.cache/pip


Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<img src="docs/\_static/img/logo.png" align="right" width="40%"/>

<!-- [![Build Status](https://travis-ci.com/hill-a/stable-baselines.svg?branch=master)](https://travis-ci.com/hill-a/stable-baselines)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3bcb4cd6d76a4270acb16b5fe6dd9efa)](https://www.codacy.com/app/baselines_janitors/stable-baselines?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=hill-a/stable-baselines&amp;utm_campaign=Badge_Grade)
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/3bcb4cd6d76a4270acb16b5fe6dd9efa)](https://www.codacy.com/app/baselines_janitors/stable-baselines?utm_source=github.com&utm_medium=referral&utm_content=hill-a/stable-baselines&utm_campaign=Badge_Coverage) -->
[![pipeline status](https://gitlab.com/araffin/stable-baselines3/badges/master/pipeline.svg)](https://gitlab.com/araffin/stable-baselines3/-/commits/master) [![Documentation Status](https://readthedocs.org/projects/stable-baselines/badge/?version=master)](https://stable-baselines3.readthedocs.io/en/master/?badge=master) [![coverage report](https://gitlab.com/araffin/stable-baselines3/badges/master/coverage.svg)](https://gitlab.com/araffin/stable-baselines3/-/commits/master)

[![Documentation Status](https://readthedocs.org/projects/stable-baselines/badge/?version=master)](https://stable-baselines3.readthedocs.io/en/master/?badge=master)

**WARNING: Stable Baselines3 is currently in a beta version, breaking changes may occur before 1.0 is released**

Expand Down
1 change: 1 addition & 0 deletions docs/misc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Bug Fixes:
^^^^^^^^^^
- Fixed a bug that prevented model trained on cpu to be loaded on gpu
- Fixed version number that had a new line included
- Fixed weird seg fault in docker image due to FakeImageEnv by reducing screen size

Deprecations:
^^^^^^^^^^^^^
Expand Down
6 changes: 3 additions & 3 deletions stable_baselines3/common/identity_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ class FakeImageEnv(Env):
:param discrete: (bool)
"""
def __init__(self, action_dim: int = 6,
screen_height: int = 210,
screen_width: int = 160,
n_channels: int = 3,
screen_height: int = 84,
screen_width: int = 84,
n_channels: int = 1,
discrete: bool = True):

self.observation_space = Box(low=0, high=255, shape=(screen_height, screen_width,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def test_sde_distribution():
dist = dist.proba_distribution(deterministic_actions, log_std, state)
actions = dist.get_actions()

assert th.allclose(actions.mean(), dist.distribution.mean.mean(), rtol=1e-3)
assert th.allclose(actions.std(), dist.distribution.scale.mean(), rtol=1e-3)
assert th.allclose(actions.mean(), dist.distribution.mean.mean(), rtol=2e-3)
assert th.allclose(actions.std(), dist.distribution.scale.mean(), rtol=2e-3)


# TODO: analytical form for squashed Gaussian?
Expand Down

0 comments on commit 257a40e

Please sign in to comment.