Commit graph

720 commits

Author SHA1 Message Date
Antonin RAFFIN
3c028f3d5c
Fix load_from_tensor (#1231) 2022-12-22 17:28:18 +01:00
Quentin Gallouédec
5549b34231
Fix `stable_baselines3/common/vec_env/vec_check_nan.py` type hints (#1226)
* super() init style

* "async_step" arg to "event"; "news" to "dones"; improve docstring

* Remove vec_check_nan from mypy exclude

* Update changelog
2022-12-22 12:24:59 +01:00
Quentin Gallouédec
9aff1137a9
Add support for Python 3.10 (#1227)
* Add python 3.10 and 3.11

* Update setup

* Fix CI

* Drop 3.11 (because of pytorch)

* Update changelog

* revert unwanted change in setup.cfg

* Remove remark about pytorch
2022-12-21 15:52:48 +01:00
Antonin RAFFIN
7202ece85b
Update tensorboard callback doc (#1221)
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
2022-12-21 12:51:28 +01:00
Quentin Gallouédec
96b1a7cf01
env_id consistency in tests (#1224)
Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2022-12-20 16:01:26 +01:00
Quentin Gallouédec
7fb8336f40
Update PR template (#1225)
Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2022-12-20 15:13:42 +01:00
Alex Pasquali
2cfcec4f50
Modified ActorCriticPolicy to support non-shared features extractor (#1148)
* Modified ActorCriticPolicy to support non-shared features extractor

* Refactored features extraction with non-shared features extractor in ActorCriticPolicy and updated doc

Doc update: added 'warning' on custom policy docs that says that, if the features extractor is non-shared, it's not possible to have shared layers in the mlp_extractor

* Moved attrib share_features_extractor in class

* Updated custom policy doc for non-shared features extractor

* Updated changelog

* Made some if-statements more readable if policies.py

The if-statements are related to the shared/non-shared features extractor in ActorCritic policies

* Simplify implementation and add run test

* Keep order in module gain to keep previous results consistents

* Fix test

* Improved docstring in policies.py

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>

* Added some tests

* feature extractor -> features extractor

* Fix test

* Fix env_id in test

* Make features extractor parameter explicit

* Remove duplicate

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Antonin Raffin <antonin.raffin@dlr.de>
2022-12-20 15:12:05 +01:00
Antonin RAFFIN
8452106734
Fix support of image like normalized inputs (#1214)
* Fix support of image like normalized inputs

* Improve docstring and warning message.

* Don't check if obs is image when normalize_images is False (lil opt)

* Comment fix

* Fix normalize_images not passed to parent

* Check for subclasses too

* Remove useless multiline

* Update version and add comment

* Fix some typos

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
2022-12-20 13:18:28 +01:00
Quentin Gallouédec
ca944fed2d
Update version (#1220)
* Replace .to(device) when possible

* fix numpy dep

* black

* Add warning for device != cpu and copy=False

* Update changelog

* Remove warning

* Update buffers.py

* Update version

* Fix type checking

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2022-12-19 13:53:00 +01:00
Antonin Raffin
9af2d11b6e
Update changelog 2022-12-19 13:21:10 +01:00
Antonin Raffin
213b06b0c6
Monkey-patch np.bool = bool 2022-12-19 13:20:48 +01:00
Quentin Gallouédec
68a40e0940
Construct tensors directly on GPU (#1218)
* Replace .to(device) when possible

* fix numpy dep

* black

* Add warning for device != cpu and copy=False

* Update changelog

* Remove warning

* Update buffers.py
2022-12-19 12:50:22 +01:00
Antonin RAFFIN
0c1bc0b1da
Fix stable_baselines3/common/atari_wrappers.py type hints (#1216)
* Fix `stable_baselines3/common/atari_wrappers.py` type hints

* Fix initialization

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
2022-12-18 16:13:44 +01:00
Antonin RAFFIN
07094c3f2e
Fix stable_baselines3/common/preprocessing.py type hints (#1217) 2022-12-18 15:53:17 +01:00
Alex Pasquali
6d55a09f81
Updated custom policy docs to better explain the `mlp_extractor`'s dimensions (#1196)
* Updated custom policy docs

Better explained how the dimensions of the mlp_extractor work, including the action net and the value net after the layers specified in net_arch.

* Improved custom policy doc

Section: Custom Network Architecture.
Explained with greater detail that an action net and a value net will be added on top of the net_arch.

* Improved custom policy doc

Section: Custom Network Architecture.
Merged a comment into a note

* Alignment

Co-authored-by: Quentin GALLOUÉDEC <gallouedec.quentin@gmail.com>
2022-12-12 16:19:51 +01:00
Quentin Gallouédec
e39bc3da00
Add support for multidimensional spaces.MultiBinary observations (#1179)
* Fix `get_obs_shape` for multidimensi onnal Multibinary space

* Update changelog

* more tests

* fix multidiscrete one-hot encoding

* refactor tests

* Update changelog.rst

* Update changelog.rst

* batched obs and revert preprocess_obs changes

* Add support for multidimensional ``spaces.MultiBinary`` observations

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
Co-authored-by: Antonin Raffin <antonin.raffin@dlr.de>
2022-12-08 18:46:41 +01:00
Quentin Gallouédec
6763a864c8
Upgrade CI/github-actions (#1204)
* checkout v2 -> v3; setup-python v2 -> v4

* Update changelog.rst
2022-12-07 16:43:47 +01:00
Athanasios Theocharis
f7d7ed3fa7
Update custom_policy.rst (#1183)
* Update custom_policy.rst

* Update changelog

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
Co-authored-by: Antonin Raffin <antonin.raffin@dlr.de>
2022-12-06 17:51:52 +01:00
Quentin Gallouédec
002850f8ac
Fix stable_baselines3/common/torch_layers.py type hint (#1191)
* Remove torch layers from mypy exclude

* Make torch layers mypy compliant

* Extra type specification

* Update changelog

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2022-11-29 23:46:32 +01:00
Zikang Xiong
852d635742
Exposed modules in __init__.py with __all__ (#1195)
* Exposed modules in __init__.py with __all__

* Remove flake8 ignore and update root __all__

* Update version

Co-authored-by: Antonin Raffin <antonin.raffin@ensta.org>
2022-11-29 23:33:46 +01:00
Quentin Gallouédec
b46396a664
Fix stable_baselines3/common/env_util.py type hint (#1192)
* Remove env_util from mypy exclude

* Fix make_atari_env type hint

* Update changelog
2022-11-29 15:36:55 +01:00
Quentin Gallouédec
5cd891317e
Add with_bias parameter to create_mlp (#1188)
* Add with_bias arg

* Update changelog

* move torch_layers to the last position

* Update version

Co-authored-by: Antonin Raffin <antonin.raffin@ensta.org>
2022-11-29 12:43:16 +01:00
Quentin Gallouédec
6902fac5e7
Fix stable_baselines3/common/type_aliases.py type hint (#1189) 2022-11-29 12:26:16 +01:00
Quentin Gallouédec
0973b01b9d
Fix tests/test_distributions.py type hint (#1186)
* Fixed test_distribution type hint

* Impose list[int] for action dim
2022-11-29 11:27:59 +01:00
Quentin Gallouédec
aee0ba03c7
Update changelog for #1184 (#1185) 2022-11-28 19:36:26 +01:00
Quentin Gallouédec
e3b24829a5
Drop gym.GoalEnv and other minor changes initally from #780 (#1184)
* Various changes from #780

* Fix env_checker for goal_env detection
2022-11-28 18:22:31 +01:00
Antonin RAFFIN
cd630a3121
Fixes for flake8 6.0 (#1181) 2022-11-25 15:14:55 +01:00
Juan Rocamonde
68b190b667
Raise error when same env object instance is passed in vectorized environment (#1154)
* Raise error when same env object instance is passed in vectorized environment

* At to changelog

* Add raises to docstring

* Add test

* Also test make_vec_env

* Fix test

* Try to enable color for MyPy

* Update version and ignore lint warnings

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
Co-authored-by: Antonin Raffin <antonin.raffin@dlr.de>
2022-11-22 14:28:58 +01:00
Quentin Gallouédec
f3abda5cbc
Fix Self return type (#1167)
* Fix Self annotation

* Update changelog

* Define type var on top

* ClassSelf to SelfClass

* annotate self

* Revert Running meanstd change

* Revert vecnormalize change (static method rejected)

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2022-11-22 13:42:39 +01:00
Antonin RAFFIN
d829a1bb04
Update README (Acknowledgments) 2022-11-21 13:15:12 +01:00
Quentin Gallouédec
abffa16198
Mypy type checking (#1143)
* Install and configure mypy

* Test if github CI uses setup.cfg for mypy

* force color output

* tab to space

* Try to fix regex

* follow_imports silent

* use space as indentation

* fix indentation setup.cfg

* Show error code

* Update doc

* Udate changelog

* Ignore mypy cache files from commit

* Update gitlab CI

* Add pytype and mypy entry in Makefile

* Make mypy happy

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2022-11-16 13:22:57 +01:00
Franz Srambical
8641b05b09
Fix typo in documentation (#1177) 2022-11-15 15:00:03 +01:00
Taimur Shahzad Gill
7e1db1aaaa
Fixed errors in the documentation (#1159)
* Fixed errors in the documentation

Fixed grammatical and punctuation errors, and improved the sentence structure.

* Added username in the contributors
2022-11-07 15:38:41 +01:00
Adam Gleave
4fb8aec215
Update evaluate_policy type annotation to support policies as well as RL algorithms (#1146)
* Add PolicyPredictor protocol and use it in evaluate_policy

* Update changelog

* Move Protocol to type_aliases to avoid circular import

* Add test for evaluate_policy on BasePolicy

* Remove unused import

* Use typing_extensions

* Move typing_extensions to 3rd party

* Add version range (typing_extensions uses SemVer)

* Import Protocol from typing_extensions only on Python<3.8

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>

* Install typing_extensions only on Python<3.8

* Add missing sys import

* Fix import ordering

* Fix observation type hint in predict

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
Co-authored-by: Quentin GALLOUÉDEC <gallouedec.quentin@gmail.com>
2022-11-03 15:36:19 +01:00
Antonin RAFFIN
0532a5719c
Fix integration documentation (#1135) 2022-10-24 13:20:58 +02:00
Antonin RAFFIN
98b40552b8 Merge pull request #1134 from simoninithomas/simoninithomas/master
Simoninithomas/master
2022-10-24 13:01:36 +02:00
Antonin Raffin
37a942c8f9
Fixes 2022-10-24 12:53:48 +02:00
Thomas Simonini
0274aaf056
Update docs/guide/integrations.rst
Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2022-10-24 11:22:33 +02:00
Thomas Simonini
fc6c111cc3 Changelog Update 2022-10-24 11:03:20 +02:00
Thomas Simonini
714737c986 Update Hugging Face Integration Documentation 2022-10-24 10:55:30 +02:00
Quentin Gallouédec
d5d1a02c15
Allow model trained with python3.7 to be loaded with python3.8+ without the custom_objects workaround (#1123)
* Fix loading

* Remove documentation note

* Update changelog

* Revert save_format change

* Add test for errors while unpickling

* Update version and cleanup

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2022-10-17 17:33:47 +02:00
Quentin Gallouédec
5ef10c8e69
Fix type annotation of `policy in BaseAlgorithm and OffPolicyAlgorithm` (#1120) 2022-10-17 10:16:20 +02:00
Juan Rocamonde
cdcdd32c51
Fix return type of evaluate_actions (#1118)
* Fix return type of ActorCriticPolicy.evaluate_actions to optional entropy tensor

* Update changelog.rst
2022-10-14 17:45:28 +02:00
Antonin RAFFIN
b77a0667b2
Add textarea for logs in issue templates (#1115)
* Add textarea for trackbacks in issue templates

* Use shell render for traceback
2022-10-13 18:47:01 +02:00
Quentin Gallouédec
1bff6215b6
New Issue forms (#1111)
* Update bug report template

* .md -> .yml

* System info section

* Custom env issue form

* documentation form

* Question template

* Feature request template

* Rm old templates

* Update changelog
2022-10-13 17:46:21 +02:00
Quentin Gallouédec
ef332fa50d
Update setup.cfg (#1113) 2022-10-12 20:09:44 +02:00
Antonin RAFFIN
508f8ffd59
Remove deprecated features and attributes (#1104)
* Remove deprecated eval env

* Remove deprecated ret attribute

* Remove sde net arch

* Remove unused code

* Update test comment

Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com>
2022-10-11 10:55:16 +02:00
Sam Toyer
5e8f06b3cb
Link to full imitation docs (#1106) 2022-10-10 21:36:30 -07:00
Antonin Raffin
4a558dd8ff
Update license file parameter 2022-10-10 16:39:57 +02:00
Antonin RAFFIN
e2f81bb70b
Release v1.6.2 (#1103)
* Release v1.6.2

* Remove Gitlab CI, no more minutes
2022-10-10 16:37:11 +02:00