From e6549be561fff86dac00dafe8a1df4649c55f815 Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Sat, 9 May 2020 20:49:44 +0200 Subject: [PATCH 01/13] Test gitlab-ci --- .gitlab-ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..8036144be --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,9 @@ +stages: + - test + +test: + stage: test + script: + - apt-get install -y python-dev python-pip cmake + - pip install -e .[extra,docs,tests] + - make type From 5d697c5f22c76b76af02b4d08c32565a84d0d0e0 Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Sat, 9 May 2020 20:54:22 +0200 Subject: [PATCH 02/13] Try different image --- .gitlab-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8036144be..ee1bd4a8d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,9 +1,11 @@ +image: stablebaselines/stable-baselines3-cpu:latest + stages: - test test: stage: test script: - - apt-get install -y python-dev python-pip cmake - - pip install -e .[extra,docs,tests] + # - apt-get install -y python-dev python-pip cmake + # - pip install -e .[extra,docs,tests] - make type From 7c5110ced2ae6ea5c7accf7b6a390fb7e80e88ff Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Sat, 9 May 2020 21:01:15 +0200 Subject: [PATCH 03/13] Add pytest and doc build --- .gitlab-ci.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee1bd4a8d..af4bbfbe6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,11 +1,15 @@ image: stablebaselines/stable-baselines3-cpu:latest -stages: - - test - -test: - stage: test +type-check: script: - # - apt-get install -y python-dev python-pip cmake - # - pip install -e .[extra,docs,tests] - make type + +pytest: + script: + # TODO: remove when atari-py will be in the docker image + - pip install -e .[extra,docs,tests] + - make test + +doc-build: + script: + - make doc From 0b5e619be141a9d144006d3cd44846ef1174b2e3 Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Sat, 9 May 2020 21:06:11 +0200 Subject: [PATCH 04/13] Fix command --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index af4bbfbe6..e4a80a124 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,7 +8,7 @@ pytest: script: # TODO: remove when atari-py will be in the docker image - pip install -e .[extra,docs,tests] - - make test + - make pytest doc-build: script: From 50241a0c24e0ed0e60f9cd13cd6c48ba21dbed68 Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Sat, 9 May 2020 21:10:21 +0200 Subject: [PATCH 05/13] Fix image used for CI --- .gitlab-ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e4a80a124..6d60ab9f9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: stablebaselines/stable-baselines3-cpu:latest +image: stablebaselines/stable-baselines3-cpu:0.6.0a5 type-check: script: @@ -6,8 +6,6 @@ type-check: pytest: script: - # TODO: remove when atari-py will be in the docker image - - pip install -e .[extra,docs,tests] - make pytest doc-build: From c9a202b471693ee0122782928758229021302d1b Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Sat, 9 May 2020 21:27:33 +0200 Subject: [PATCH 06/13] Seperate pytest builds --- .gitlab-ci.yml | 13 +++++++++++-- README.md | 6 ++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6d60ab9f9..933f08ce2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,9 +4,18 @@ type-check: script: - make type -pytest: +# Cut pytest into 3 to avoid memory issues +pytest-1: script: - - make pytest + - ./scripts/run_tests_travis.sh "[a-d]*" + +pytest-2: + script: + - ./scripts/run_tests_travis.sh "[e-r]*" + +pytest-3: + script: + - ./scripts/run_tests_travis.sh "[s-z]*" doc-build: script: diff --git a/README.md b/README.md index f14a919e5..6be439c87 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ - +[![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) + -[![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** From cb0b724fd6361cf276851e0c544d4d72176e1b75 Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Sat, 9 May 2020 21:37:38 +0200 Subject: [PATCH 07/13] Fix weird seg fault in docker image due to FakeImageEnv --- .gitlab-ci.yml | 13 ++----------- README.md | 3 +-- docs/misc/changelog.rst | 1 + stable_baselines3/common/identity_env.py | 6 +++--- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 933f08ce2..9e62d9b59 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,18 +4,9 @@ type-check: script: - make type -# Cut pytest into 3 to avoid memory issues -pytest-1: +pytest: script: - - ./scripts/run_tests_travis.sh "[a-d]*" - -pytest-2: - script: - - ./scripts/run_tests_travis.sh "[e-r]*" - -pytest-3: - script: - - ./scripts/run_tests_travis.sh "[s-z]*" + - make test doc-build: script: diff --git a/README.md b/README.md index 6be439c87..791af110c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ -[![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) - +[![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) **WARNING: Stable Baselines3 is currently in a beta version, breaking changes may occur before 1.0 is released** diff --git a/docs/misc/changelog.rst b/docs/misc/changelog.rst index baa9919fd..21d5f1fb3 100644 --- a/docs/misc/changelog.rst +++ b/docs/misc/changelog.rst @@ -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: ^^^^^^^^^^^^^ diff --git a/stable_baselines3/common/identity_env.py b/stable_baselines3/common/identity_env.py index e1bb9c293..2f3ce28f7 100644 --- a/stable_baselines3/common/identity_env.py +++ b/stable_baselines3/common/identity_env.py @@ -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, From ad76929a1dd9892b84cfdc434d0a6598051eefbe Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Sat, 9 May 2020 21:40:36 +0200 Subject: [PATCH 08/13] Fix make command --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9e62d9b59..6d60ab9f9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,7 @@ type-check: pytest: script: - - make test + - make pytest doc-build: script: From 884d42096378f2659d843337ed5d4466e5c681e2 Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Sat, 9 May 2020 21:46:54 +0200 Subject: [PATCH 09/13] [ci skip] Add space in the badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 791af110c..c3e9850d2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -[![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) +[![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) **WARNING: Stable Baselines3 is currently in a beta version, breaking changes may occur before 1.0 is released** From 18946f1e5605e9a1897dd7bf70fefa403dacc5c7 Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Sat, 9 May 2020 22:02:51 +0200 Subject: [PATCH 10/13] Fix CI failures --- .gitlab-ci.yml | 5 ++++- tests/test_distributions.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6d60ab9f9..c38c12951 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,10 @@ type-check: pytest: script: - - make pytest + # TODO: remove when opencv and atari installed in the docker image + - pip install -e.[extra,tests,docs] + # MKL_THREADING_LAYER=GNU to avoid MKL_THREADING_LAYER=INTEL incompatibility error + - MKL_THREADING_LAYER=GNU make pytest doc-build: script: diff --git a/tests/test_distributions.py b/tests/test_distributions.py index 1f340bb7d..e9041f8dc 100644 --- a/tests/test_distributions.py +++ b/tests/test_distributions.py @@ -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? From 50895ed82b276d70aeb931bb0105acd0591ce598 Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Sat, 9 May 2020 22:21:19 +0200 Subject: [PATCH 11/13] Re-install opencv --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c38c12951..ccffc5ce6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,8 @@ type-check: pytest: script: # TODO: remove when opencv and atari installed in the docker image - - pip install -e.[extra,tests,docs] + # fix: https://github.com/NVIDIA/nvidia-docker/issues/864 + - pip install gym[atari] # MKL_THREADING_LAYER=GNU to avoid MKL_THREADING_LAYER=INTEL incompatibility error - MKL_THREADING_LAYER=GNU make pytest From 7d56e43a1a0105d980618b7104bb0b27f518e670 Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Sat, 9 May 2020 22:28:02 +0200 Subject: [PATCH 12/13] Use opencv-headless --- .gitlab-ci.yml | 6 +++--- Dockerfile | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ccffc5ce6..bfa0e22a1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,9 +6,9 @@ type-check: pytest: script: - # TODO: remove when opencv and atari installed in the docker image - # fix: https://github.com/NVIDIA/nvidia-docker/issues/864 - - pip install gym[atari] + # TODO: remove when opencv properly installed in the docker image + # see https://github.com/NVIDIA/nvidia-docker/issues/864 + - pip install opencv-python-headless # MKL_THREADING_LAYER=GNU to avoid MKL_THREADING_LAYER=INTEL incompatibility error - MKL_THREADING_LAYER=GNU make pytest diff --git a/Dockerfile b/Dockerfile index d573be756..be8eb57b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 From 58c76b91b1b8d370856263a0823d498a08b8ce05 Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Sat, 9 May 2020 22:48:16 +0200 Subject: [PATCH 13/13] Test with new docker image --- .gitlab-ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bfa0e22a1..e422082af 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: stablebaselines/stable-baselines3-cpu:0.6.0a5 +image: stablebaselines/stable-baselines3-cpu:0.6.0a7 type-check: script: @@ -6,9 +6,6 @@ type-check: pytest: script: - # TODO: remove when opencv properly installed in the docker image - # see https://github.com/NVIDIA/nvidia-docker/issues/864 - - pip install opencv-python-headless # MKL_THREADING_LAYER=GNU to avoid MKL_THREADING_LAYER=INTEL incompatibility error - MKL_THREADING_LAYER=GNU make pytest