Add Gitlab CI (#12)

* 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
This commit is contained in:
Antonin RAFFIN 2020-05-09 23:10:49 +02:00 committed by GitHub
parent a06c4a7859
commit 257a40ef4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 9 deletions

14
.gitlab-ci.yml Normal file
View file

@ -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

View file

@ -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

View file

@ -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**

View file

@ -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:
^^^^^^^^^^^^^

View file

@ -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,

View file

@ -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?