mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-11-17 08:56:08 +00:00
Release v1.6.0 (#958)
* Release v1.6.0 + update doc + add copy button * Update read the doc conda env * Update year * Fix bug in kl divergence check * Rephrase requirement for envpool and isaac gym
This commit is contained in:
parent
ef10189d80
commit
c1f1c3d3d7
10 changed files with 52 additions and 9 deletions
|
|
@ -6,9 +6,9 @@ dependencies:
|
||||||
- cpuonly=1.0=0
|
- cpuonly=1.0=0
|
||||||
- pip=21.1
|
- pip=21.1
|
||||||
- python=3.7
|
- python=3.7
|
||||||
- pytorch=1.8.1=py3.7_cpu_0
|
- pytorch=1.11=py3.7_cpu_0
|
||||||
- pip:
|
- pip:
|
||||||
- gym>=0.17.2
|
- gym==0.21
|
||||||
- cloudpickle
|
- cloudpickle
|
||||||
- opencv-python-headless
|
- opencv-python-headless
|
||||||
- pandas
|
- pandas
|
||||||
|
|
@ -16,5 +16,5 @@ dependencies:
|
||||||
- matplotlib
|
- matplotlib
|
||||||
- sphinx_autodoc_typehints
|
- sphinx_autodoc_typehints
|
||||||
- sphinx>=4.2
|
- sphinx>=4.2
|
||||||
# See https://github.com/readthedocs/sphinx_rtd_theme/issues/1115
|
|
||||||
- sphinx_rtd_theme>=1.0
|
- sphinx_rtd_theme>=1.0
|
||||||
|
- sphinx_copybutton
|
||||||
|
|
|
||||||
13
docs/conf.py
13
docs/conf.py
|
|
@ -24,6 +24,14 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
enable_spell_check = False
|
enable_spell_check = False
|
||||||
|
|
||||||
|
# Try to enable copy button
|
||||||
|
try:
|
||||||
|
import sphinx_copybutton # noqa: F401
|
||||||
|
|
||||||
|
enable_copy_button = True
|
||||||
|
except ImportError:
|
||||||
|
enable_copy_button = False
|
||||||
|
|
||||||
# source code directory, relative to this file, for sphinx-autobuild
|
# source code directory, relative to this file, for sphinx-autobuild
|
||||||
sys.path.insert(0, os.path.abspath(".."))
|
sys.path.insert(0, os.path.abspath(".."))
|
||||||
|
|
||||||
|
|
@ -51,7 +59,7 @@ with open(version_file) as file_handler:
|
||||||
# -- Project information -----------------------------------------------------
|
# -- Project information -----------------------------------------------------
|
||||||
|
|
||||||
project = "Stable Baselines3"
|
project = "Stable Baselines3"
|
||||||
copyright = "2020, Stable Baselines3"
|
copyright = "2022, Stable Baselines3"
|
||||||
author = "Stable Baselines3 Contributors"
|
author = "Stable Baselines3 Contributors"
|
||||||
|
|
||||||
# The short X.Y version
|
# The short X.Y version
|
||||||
|
|
@ -83,6 +91,9 @@ extensions = [
|
||||||
if enable_spell_check:
|
if enable_spell_check:
|
||||||
extensions.append("sphinxcontrib.spelling")
|
extensions.append("sphinxcontrib.spelling")
|
||||||
|
|
||||||
|
if enable_copy_button:
|
||||||
|
extensions.append("sphinx_copybutton")
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
templates_path = ["_templates"]
|
templates_path = ["_templates"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -729,6 +729,16 @@ to keep track of the agent progress.
|
||||||
model.learn(10_000)
|
model.learn(10_000)
|
||||||
|
|
||||||
|
|
||||||
|
SB3 with EnvPool or Isaac Gym
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
Just like Procgen (see above), `EnvPool <https://github.com/sail-sg/envpool>`_ and `Isaac Gym <https://github.com/NVIDIA-Omniverse/IsaacGymEnvs>`_ accelerate the environment by
|
||||||
|
already providing a vectorized implementation.
|
||||||
|
|
||||||
|
To use SB3 with those tools, you must wrap the env with tool's specific ``VecEnvWrapper`` that will pre-process the data for SB3,
|
||||||
|
you can find links to those wrappers in `issue #772 <https://github.com/DLR-RM/stable-baselines3/issues/772#issuecomment-1048657002>`_.
|
||||||
|
|
||||||
|
|
||||||
Record a Video
|
Record a Video
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,17 @@ Bleeding-edge version
|
||||||
pip install git+https://github.com/DLR-RM/stable-baselines3
|
pip install git+https://github.com/DLR-RM/stable-baselines3
|
||||||
|
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
If you want to use latest gym version (0.24+), you have to use
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
pip install git+https://github.com/carlosluis/stable-baselines3/tree/fix_tests
|
||||||
|
|
||||||
|
See `PR #780 <https://github.com/DLR-RM/stable-baselines3/pull/780>`_ for more information.
|
||||||
|
|
||||||
|
|
||||||
Development version
|
Development version
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,11 @@ Changelog
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
|
||||||
Release 1.5.1a9 (WIP)
|
Release 1.6.0 (2022-07-11)
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
|
**Recurrent PPO (PPO LSTM), better defaults for learning from pixels with SAC/TD3**
|
||||||
|
|
||||||
Breaking Changes:
|
Breaking Changes:
|
||||||
^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^
|
||||||
- Changed the way policy "aliases" are handled ("MlpPolicy", "CnnPolicy", ...), removing the former
|
- Changed the way policy "aliases" are handled ("MlpPolicy", "CnnPolicy", ...), removing the former
|
||||||
|
|
@ -34,6 +36,7 @@ Bug Fixes:
|
||||||
- Fixed issues due to newer version of protobuf (tensorboard) and sphinx
|
- Fixed issues due to newer version of protobuf (tensorboard) and sphinx
|
||||||
- Fix exception causes all over the codebase (@cool-RR)
|
- Fix exception causes all over the codebase (@cool-RR)
|
||||||
- Prohibit simultaneous use of optimize_memory_usage and handle_timeout_termination due to a bug (@MWeltevrede)
|
- Prohibit simultaneous use of optimize_memory_usage and handle_timeout_termination due to a bug (@MWeltevrede)
|
||||||
|
- Fixed a bug in ``kl_divergence`` check that would fail when using numpy arrays with MultiCategorical distribution
|
||||||
|
|
||||||
Deprecations:
|
Deprecations:
|
||||||
^^^^^^^^^^^^^
|
^^^^^^^^^^^^^
|
||||||
|
|
@ -51,6 +54,8 @@ Documentation:
|
||||||
- Added remark about breaking Markov assumption and timeout handling
|
- Added remark about breaking Markov assumption and timeout handling
|
||||||
- Added doc about MLFlow integration via custom logger (@git-thor)
|
- Added doc about MLFlow integration via custom logger (@git-thor)
|
||||||
- Updated Huggingface integration doc
|
- Updated Huggingface integration doc
|
||||||
|
- Added copy button for code snippets
|
||||||
|
- Added doc about EnvPool and Isaac Gym support
|
||||||
|
|
||||||
|
|
||||||
Release 1.5.0 (2022-03-25)
|
Release 1.5.0 (2022-03-25)
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -111,6 +111,8 @@ setup(
|
||||||
"sphinxcontrib.spelling",
|
"sphinxcontrib.spelling",
|
||||||
# Type hints support
|
# Type hints support
|
||||||
"sphinx-autodoc-typehints",
|
"sphinx-autodoc-typehints",
|
||||||
|
# Copy button for code snippets
|
||||||
|
"sphinx_copybutton",
|
||||||
],
|
],
|
||||||
"extra": [
|
"extra": [
|
||||||
# For render
|
# For render
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,8 @@ class ReplayBuffer(BaseBuffer):
|
||||||
# see https://github.com/DLR-RM/stable-baselines3/issues/934
|
# see https://github.com/DLR-RM/stable-baselines3/issues/934
|
||||||
if optimize_memory_usage and handle_timeout_termination:
|
if optimize_memory_usage and handle_timeout_termination:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"ReplayBuffer does not support optimize_memory_usage = True and handle_timeout_termination = True simultaneously."
|
"ReplayBuffer does not support optimize_memory_usage = True "
|
||||||
|
"and handle_timeout_termination = True simultaneously."
|
||||||
)
|
)
|
||||||
self.optimize_memory_usage = optimize_memory_usage
|
self.optimize_memory_usage = optimize_memory_usage
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ from abc import ABC, abstractmethod
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||||
|
|
||||||
import gym
|
import gym
|
||||||
|
import numpy as np
|
||||||
import torch as th
|
import torch as th
|
||||||
from gym import spaces
|
from gym import spaces
|
||||||
from torch import nn
|
from torch import nn
|
||||||
|
|
@ -688,7 +689,7 @@ def kl_divergence(dist_true: Distribution, dist_pred: Distribution) -> th.Tensor
|
||||||
# MultiCategoricalDistribution is not a PyTorch Distribution subclass
|
# MultiCategoricalDistribution is not a PyTorch Distribution subclass
|
||||||
# so we need to implement it ourselves!
|
# so we need to implement it ourselves!
|
||||||
if isinstance(dist_pred, MultiCategoricalDistribution):
|
if isinstance(dist_pred, MultiCategoricalDistribution):
|
||||||
assert dist_pred.action_dims == dist_true.action_dims, "Error: distributions must have the same input space"
|
assert np.allclose(dist_pred.action_dims, dist_true.action_dims), "Error: distributions must have the same input space"
|
||||||
return th.stack(
|
return th.stack(
|
||||||
[th.distributions.kl_divergence(p, q) for p, q in zip(dist_true.distribution, dist_pred.distribution)],
|
[th.distributions.kl_divergence(p, q) for p, q in zip(dist_true.distribution, dist_pred.distribution)],
|
||||||
dim=1,
|
dim=1,
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
1.5.1a9
|
1.6.0
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,9 @@ def test_categorical(dist, CAT_ACTIONS):
|
||||||
BernoulliDistribution(N_ACTIONS).proba_distribution(th.rand(N_ACTIONS)),
|
BernoulliDistribution(N_ACTIONS).proba_distribution(th.rand(N_ACTIONS)),
|
||||||
CategoricalDistribution(N_ACTIONS).proba_distribution(th.rand(N_ACTIONS)),
|
CategoricalDistribution(N_ACTIONS).proba_distribution(th.rand(N_ACTIONS)),
|
||||||
DiagGaussianDistribution(N_ACTIONS).proba_distribution(th.rand(N_ACTIONS), th.rand(N_ACTIONS)),
|
DiagGaussianDistribution(N_ACTIONS).proba_distribution(th.rand(N_ACTIONS), th.rand(N_ACTIONS)),
|
||||||
MultiCategoricalDistribution([N_ACTIONS, N_ACTIONS]).proba_distribution(th.rand(1, sum([N_ACTIONS, N_ACTIONS]))),
|
MultiCategoricalDistribution(np.array([N_ACTIONS, N_ACTIONS])).proba_distribution(
|
||||||
|
th.rand(1, sum([N_ACTIONS, N_ACTIONS]))
|
||||||
|
),
|
||||||
SquashedDiagGaussianDistribution(N_ACTIONS).proba_distribution(th.rand(N_ACTIONS), th.rand(N_ACTIONS)),
|
SquashedDiagGaussianDistribution(N_ACTIONS).proba_distribution(th.rand(N_ACTIONS), th.rand(N_ACTIONS)),
|
||||||
StateDependentNoiseDistribution(N_ACTIONS).proba_distribution(
|
StateDependentNoiseDistribution(N_ACTIONS).proba_distribution(
|
||||||
th.rand(N_ACTIONS), th.rand([N_ACTIONS, N_ACTIONS]), th.rand([N_ACTIONS, N_ACTIONS])
|
th.rand(N_ACTIONS), th.rand([N_ACTIONS, N_ACTIONS]), th.rand([N_ACTIONS, N_ACTIONS])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue