Commit graph

449 commits

Author SHA1 Message Date
Antonin RAFFIN
15d32c6a4a
Update black version + update docker image (#151)
* Update docker image

* Update black and reformat
2020-08-27 23:02:59 +02:00
Antonin RAFFIN
a1afc5e42f
Fix typos in SAC and TD3 (#145) 2020-08-23 17:44:35 +02:00
Stelios Tymvios
9003a09d5b
Callbacks have access to locals (#115)
* callbacks have access to locals

* changeloc

* doc

* callbacks have access to locals

* changeloc

* doc

* Added update function for child callbacks

* Pre-Release 0.8.0 (#134)

* Fix double reset and improve typing coverage (#136)

* Fix double reset and improve typing coverage

* Revert minor edit

* Add doc about types

* Update child callbacks

* cleaned imports

* format

* import order

* Simplify tests and add comments

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-08-23 14:34:01 +02:00
Sam Toyer
42ef6d4677
Remove "device" argument from policies (#141)
* Remove device arg from policies

* Clean up for PR

* Update test and doc

* Fix codestyle

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-08-23 13:27:52 +02:00
Antonin RAFFIN
21e9994ff9
Fix double reset and improve typing coverage (#136)
* Fix double reset and improve typing coverage

* Revert minor edit

* Add doc about types
2020-08-05 13:12:02 +03:00
Antonin RAFFIN
cceffd5ab2
Pre-Release 0.8.0 (#134) 2020-08-03 22:38:54 +02:00
Anssi
2cd6a4f93b
Match performance with stable-baselines (discrete case) (#110)
* Fix storing correct episode dones

* Fix number of filters in NatureCNN network

* Add TF-like RMSprop for matching performance with sb2

* Remove stuff that was accidentally included

* Reformat

* Clarify variable naming

* Update changelog

* Add comment on RMSprop implementations to A2C

* Add test for RMSpropTFLike

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-08-03 22:22:51 +02:00
RaphaelWag
3253ee11e7
Update custom_policy.rst (#125)
* Update custom_policy.rst

Fixed Typo

* Update changelog.rst

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-07-31 11:10:48 +02:00
Anssi
77cb3dd0ab
Separate feature extractor networks for DQN networks (#132)
* Separate feature extractor networks for DQN networks

* [ci skip] Bump version

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-07-30 20:48:30 +02:00
Andy Shih
8f9aaaebe9
fix approximate entropy calculation in PPO and A2C (#130) 2020-07-29 21:19:41 +02:00
rk37
bd2aae0c27
Fix ortho init when bias=False with custom policy (#126)
* Update policies.py

fix AttributeError occurred when use "bias=False" linear layer in custom FeaturesExtractor #124

* Update changelog.rst

 update the changelog accordingly

* Update changelog.rst

Co-authored-by: Kong Lingchao <konglingchao@gmail.com>
Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-07-25 22:35:48 +02:00
Steven H. Wang
83530560b5
Fix CloudpickleWrapper load (#118)
* CloudpickleWrapper: Load using cloudpickle

* Update changelog
2020-07-21 10:12:39 +02:00
Antonin RAFFIN
41b66e33ce [ci skip] Remove whitespace 2020-07-20 11:20:12 +02:00
Stelios Tymvios
dbe8cfceb6
Optimized polyak updates (#106)
* quick polyak updates

* changelog

* typing

* reverted autoformatting

* rerverted autofmt

* Update stable_baselines3/common/utils.py

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>

* parameter names in test

* cleanup

* Merge branch 'master' into polyak

* Update changelog

* Apply suggestions from code review

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>

* Update stable_baselines3/common/utils.py

* Update utils.py

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-07-17 15:53:28 +02:00
Antonin RAFFIN
23afedb254
Auto-formatting with black and isort (#97)
* Add auto formatting with black and isort

* Reformat code

* Ignore typing errors

* Add note about line length

* Add minimum version for isort

* Add commit-checks

* Update docker image

* Fixed lost import (during last merge)

* Fix opencv dependency
2020-07-16 16:12:16 +02:00
Antonin RAFFIN
5ff176b2f1
Implement DDPG (#92)
* Add DDPG + TD3 with any number of critics

* Allow any number of critics for SAC

* Update doc

* [ci skip] Update DDPG example

* Remove unused parameter

* Add DDPG to identity test

* Fix computation with n_critics=1,3

* Update doc

* Apply suggestions from code review

Co-authored-by: Adam Gleave <adam@gleave.me>

* Update docstrings for off-policy algos

* Add check for sde

Co-authored-by: Adam Gleave <adam@gleave.me>
2020-07-16 14:14:22 +02:00
Antonin RAFFIN
208890dfc8
Ignore errors from new pytype version (#107) 2020-07-16 11:54:37 +02:00
Joel Joseph
3cf6e9714b
Update ppo.rst (#94)
* Update ppo.rst

minor correction from A2C to PPO

* Update changelog.rst

* Update changelog.rst

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-07-10 10:38:35 +02:00
Adam Gleave
758b140b9d
Merge pull request #91 from DLR-RM/base-review-2
Refactor BasePolicy into BaseModel + other minor changes
2020-07-08 12:18:44 -07:00
Adam Gleave
fc0b0b8824 Lint 2020-07-07 19:05:10 -07:00
Adam Gleave
e7130344de Add changelog entry 2020-07-07 19:03:46 -07:00
Adam Gleave
1dbbf75036 Merge remote-tracking branch 'origin/master' into base-review-2 2020-07-07 18:57:57 -07:00
Adam Gleave
bf73f01ee9 Merge branch 'base-class-review' of github.com:DLR-RM/stable-baselines3 into base-class-review 2020-07-07 18:57:35 -07:00
Adam Gleave
c39ed397ac
Merge pull request #89 from DLR-RM/base-class-review
Refactor and clean-up of common code
2020-07-07 18:53:51 -07:00
Adam Gleave
0345591dea Refactor BasePolicy by introducing new BaseModel ABC for Critic's to inherit from. 2020-07-07 18:51:44 -07:00
Adam Gleave
91bbc28c0f Address minor issues after clarification by @araffin 2020-07-07 18:39:55 -07:00
Antonin RAFFIN
bea1e023bb
Merge branch 'master' into base-class-review 2020-07-07 10:01:03 +02:00
Antonin RAFFIN
3756d05f72
Refactored ContinuousCritic for SAC/TD3 (#78)
* Refactored ContinuousCritic for SAC/TD3

* Address comments

* Add pybullet notebook
2020-07-07 01:02:51 +03:00
Adam Gleave
e61d34a6f0 Fix typing, key error 2020-07-02 21:35:06 -07:00
Adam Gleave
e9d8e05cc8 Review policies 2020-07-02 21:04:52 -07:00
Adam Gleave
cc7a58bc5f Bugfix 2020-07-02 20:28:48 -07:00
Adam Gleave
7ba48dce48 Review distributions 2020-07-02 19:18:51 -07:00
Adam Gleave
56fd89da8d Review type aliases 2020-07-02 18:51:10 -07:00
Adam Gleave
1f0443f332 Review base_class 2020-07-02 18:49:59 -07:00
Adam Gleave
2affbd6856 Fix linting and make it play nicely with venv 2020-07-02 18:14:54 -07:00
Stelios Tymvios
4aa66ed34a
Automatically create paths for saved objects (#80)
* automatically create paths for saved objects

* Minor Corrections, more tests

* linting

* typing

* Correct mode checking

* corrected tests to reflect new verbose functionality
2020-07-03 01:14:21 +03:00
Marios Koulakis
7d8ebb9e98
Udacity Reacher Project with Unity (#79)
* Add the reacher project to the sample projects

* Update the change log

* Remove github incompatible link notation

* Update changelog.rst

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-06-30 15:03:02 +02:00
Antonin RAFFIN
08e7519381
Fix q-target in SAC (#77)
* Fix q-target in SAC

* [ci skip] Update version
2020-06-29 17:58:55 +02:00
Noah
96b771f24e
Implement DQN (#28)
* Created DQN template according to the paper.
Next steps:
- Create Policy
- Complete Training
- Debug

* Changed Base Class

* refactor save, to be consistence with overriding the excluded_save_params function. Do not try to exclude the parameters twice.

* Added simple DQN policy

* Finished learn and train function
- missing correct loss computation

* changed collect_rollouts to work with discrete space

* moved discrete space collect_rollouts to dqn

* basic dqn working

* deleted SDE related code

* added gradient clipping and moved greedy policy to policy

* changed policy to implement target network
and added soft update(in fact standart tau is 1 so hard update)

* fixed policy setup

* rebase target_update_intervall on _n_updates

* adapted all tests
all tests passing

* Move to stable-baseline3

* Fixes for DQN

* Fix tests + add CNNPolicy

* Allow any optimizer for DQN

* added some util functions to create a arbitrary linear schedule, fixed pickle problem with old exploration schedule

* more documentation

* changed buffer dtype

* refactor and document

* Added Sphinx Documentation
Updated changelog.rst

* removed custom collect_rollouts as it is no longer necessary

* Implemented suggestions to clean code and documentation.

* extracted some functions on tests to reduce duplicated code

* added support for exploration_fraction

* Fixed exploration_fraction

* Added documentation

* Fixed get_linear_fn -> proper progress scaling

* Merged master

* Added nature reference

* Changed default parameters to https://www.nature.com/articles/nature14236/tables/1

* Fixed n_updates to be incremented correctly

* Correct train_freq

* Doc update

* added special parameter for DQN in tests

* different fix for test_discrete

* Update docs/modules/dqn.rst

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>

* Update docs/modules/dqn.rst

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>

* Update docs/modules/dqn.rst

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>

* Added RMSProp in optimizer_kwargs, as described in nature paper

* Exploration fraction is inverse of 50.000.000 (total frames) / 1.000.000 (frames with linear schedule) according to nature paper

* Changelog update for buffer dtype

* standard exlude parameters should be always excluded to assure proper saving only if intentionally included by ``include`` parameter

* slightly more iterations on test_discrete to pass the test

* added param use_rms_prop instead of mutable default argument

* forgot alpha

* using huber loss, adam and learning rate 1e-4

* account for train_freq in update_target_network

* Added memory check for both buffers

* Doc updated for buffer allocation

* Added psutil Requirement

* Adapted test_identity.py

* Fixes with new SB3 version

* Fix for tensorboard name

* Convert assert to warning and fix tests

* Refactor off-policy algorithms

* Fixes

* test: remove next_obs in replay buffer

* Update changelog

* Fix tests and use tmp_path where possible

* Fix sampling bug in buffer

* Do not store next obs on episode termination

* Fix replay buffer sampling

* Update comment

* moved epsilon from policy to model

* Update predict method

* Update atari wrappers to match SB2

* Minor edit in the buffers

* Update changelog

* Merge branch 'master' into dqn

* Update DQN to new structure

* Fix tests and remove hardcoded path

* Fix for DQN

* Disable memory efficient replay buffer by default

* Fix docstring

* Add tests for memory efficient buffer

* Update changelog

* Split collect rollout

* Move target update outside `train()` for DQN

* Update changelog

* Update linear schedule doc

* Cleanup DQN code

* Minor edit

* Update version and docker images

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-06-29 11:16:54 +02:00
JieQiang (Jay) Wei
e47da426c1
Update rl_zoo.rst (#72)
* Update rl_zoo.rst

a typo fixed.

* Update changelog.rst

Fixed a typo in zoo readme.

* Update changelog.rst

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-06-25 12:14:56 +02:00
Matthias K
977a615c82
Fixed SubprocVecEnv close. (#68)
Updated changelog.

Co-authored-by: Matthias K <wirspielen@web.de>
2020-06-20 18:01:37 +02:00
Tirafesi
644d2c17ac
save_replay_buffer now receives as argument the file path instead of the folder path (#63)
* save_replay_buffer now receives as argument the file path instead of the folder path

* Update changelog.rst

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-06-17 14:00:49 +02:00
Antonin RAFFIN
a861f33107
Update notebooks (#65) 2020-06-17 12:47:09 +02:00
Antonin RAFFIN
494ebfd20a
Hotfix PPO + gSDE (#53)
* Fix variable being passed with gradients

* Update changelog

* Bump version

* Fixes #54
2020-06-10 18:58:35 +02:00
Anssi
b833207142
Add some missing tests, update VecNormalize and RolloutBuffer (#50)
* Change saving/loading normalization parameters to use single pickle file

* Remove 'use_gae' from RolloutBuffer compute_returns function

* Add some missing tests for normalizer, nan-checker and PPO clip_value_fn argument

* Update changelog

* Fix typo

* Use proper pytest.raises for catching errors in tests

* Add comment on GAE and how to obtain non-GAE behaviour

* Remove save/load_running_average from VecNormalize in favor of load/save

* Update changelog

* Update docstring

* Add accidentally removed tests for VecNormalize

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-06-10 12:09:04 +02:00
Anssi
44f8218df0
Review of code (A2C, PPO and refactoring) (#35)
* Split torch module code into torch_layers file

* Updated reference to CNN

* Change 'CxWxH' to 'CxHxW', as per common notion

* Fix missing import in policies.py

* Move PPOPolicy to OnlineActorCriticPolicy

* Create OnPolicyRLModel from PPO, and make A2C and PPO inherit

* Update A2C optimizer comment

* Clean weight init scales for clarity

* Fix A2C log_interval default parameter

* Rename 'progress' to 'progress_remaining

* Rename 'Models' to 'Algorithms'

* Rename 'OnlineActorCriticPolicy' to 'ActorCriticPolicy'

* Move static functions out from BaseAlgorithm

* Move on/off_policy base algorithms to their own files

* Add  files for A2C/PPO

* Fix docs

* Fix pytype

* Update documentation on OnPolicyAlgorithm

* Add proper doctstring for on_policy rollout gathering

* Add bit clarification on the mlppolicy/cnnpolicy naming

* Move static function is_vectorized_policies to utils.py

* Checking docstrings, pep8 fixes

* Update changelog

* Clean changelog

* Remove policy warnings for sac/td3

* Add monitor_wrapper for OnPolicyAlgorithm. Clean tb logging variables. Add parameter keywords to OffPolicyAlgorithm super init

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-06-09 13:54:18 +02:00
Antonin RAFFIN
11d33eb4ae
Fix gSDE loading issue in test mode (#45)
* Fix gSDE loading issue in test mode

* Forward `reset_noise` method

* Re-add `make_actor`

* Reformat
2020-06-08 11:15:10 +02:00
Antonin RAFFIN
353ea81080
Fix several VecEnv issues, add fork start method to tests (#43)
* Fix several VecEnv issues, add `fork` start method to tests

* Fix signature
2020-06-04 11:22:12 +02:00
Antonin RAFFIN
403fff5d50
Pre-Release v0.6.0 (#39)
* Prepare release

* Update docker images
2020-06-01 13:09:47 +02:00
Roland Gavrilescu
bb01253261
Tensorboard integration (#30)
* init commit tensorboard-integration

* Added tb logger to ppo (with output exclusions)

* fixed truncated stdout

* categorize stdout outputs by tag

* separated exclusions from values, added missing logs

* saving exclusions as dict instead of list

* reformatting, auto run indexing

* included renaming suggestions, fixed tests

* tb support for sac

* linting

* moved logging to base class

* tb support for td3

* removed histograms, non-verbose output working

* modifed changelog

* linting

* fixed type error

* moved logger config to utils

* removed episode_rewards log from ppo

* Enable tensorboard in tests

* Remove unused import

* Update logger sub titles

* Minor edit for PPO

* Update logger and tb log folder

* Pass correct logger to Callbacks

* updated docs

* added tb example image to docs

* add support for continuing training in tensorboard

* added tensorboard to docs index

* added tb test

* moved logger config to _setup_learn, updated tests

* accessing verbose from base class

* Update doc and tests

* Rename session -> time

* Update version

* Update logger truncate

* Update types

* Remove duplicated code

Co-authored-by: Antonin RAFFIN <antonin.raffin@ensta.org>
2020-06-01 11:55:44 +02:00