Fix numpy warning and update migration guide (#307)

This commit is contained in:
Antonin RAFFIN 2021-02-01 11:24:44 +01:00 committed by GitHub
parent d7c6aff252
commit c722c4f5bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 5 deletions

View file

@ -49,6 +49,7 @@ Breaking Changes
- We dropped GAIL support as we are focusing on model-free RL only, you can however take a look at the :ref:`imitation project <imitation>` which implements
GAIL and other imitation learning algorithms on top of SB3.
- ``action_probability`` is currently not implemented in the base class
- ``pretrain()`` method for behavior cloning was removed (see `issue #27 <https://github.com/DLR-RM/stable-baselines3/issues/27>`_)
You can take a look at the `issue about SB3 implementation design <https://github.com/hill-a/stable-baselines/issues/576>`_ for more details.

View file

@ -3,7 +3,7 @@
Changelog
==========
Pre-Release 0.11.0a6 (WIP)
Pre-Release 0.11.0a7 (WIP)
-------------------------------
Breaking Changes:
@ -38,6 +38,7 @@ Bug Fixes:
- Added informative ``PPO`` construction error in edge-case scenario where ``n_steps * n_envs = 1`` (size of rollout buffer),
which otherwise causes downstream breaking errors in training (@decodyng)
- Fixed discrete observation space support when using multiple envs with A2C/PPO (thanks @ardabbour)
- Fixed numpy warning (replaced ``np.bool`` with ``bool``)
Deprecations:
^^^^^^^^^^^^^
@ -66,6 +67,7 @@ Documentation:
- Fix docstring of classes in atari_wrappers.py which were inside the constructor (@LucasAlegre)
- Added SB3-Contrib page
- Fix bug in the example code of DQN (@AptX395)
- Updated migration guide
Pre-Release 0.10.0 (2020-10-28)
-------------------------------

View file

@ -377,7 +377,7 @@ class BaseAlgorithm(ABC):
# Avoid resetting the environment when calling ``.learn()`` consecutive times
if reset_num_timesteps or self._last_obs is None:
self._last_obs = self.env.reset()
self._last_dones = np.zeros((self.env.num_envs,), dtype=np.bool)
self._last_dones = np.zeros((self.env.num_envs,), dtype=bool)
# Retrieve unnormalized observation for saving into the buffer
if self._vec_normalize_env is not None:
self._last_original_obs = self._vec_normalize_env.get_original_obs()

View file

@ -447,7 +447,7 @@ class StopTrainingOnRewardThreshold(BaseCallback):
def _on_step(self) -> bool:
assert self.parent is not None, "``StopTrainingOnMinimumReward`` callback must be used " "with an ``EvalCallback``"
# Convert np.bool to bool, otherwise callback() is False won't work
# Convert np.bool_ to bool, otherwise callback() is False won't work
continue_training = bool(self.parent.best_mean_reward < self.reward_threshold)
if self.verbose > 0 and not continue_training:
print(

View file

@ -29,7 +29,7 @@ class DummyVecEnv(VecEnv):
self.keys, shapes, dtypes = obs_space_info(obs_space)
self.buf_obs = OrderedDict([(k, np.zeros((self.num_envs,) + tuple(shapes[k]), dtype=dtypes[k])) for k in self.keys])
self.buf_dones = np.zeros((self.num_envs,), dtype=np.bool)
self.buf_dones = np.zeros((self.num_envs,), dtype=bool)
self.buf_rews = np.zeros((self.num_envs,), dtype=np.float32)
self.buf_infos = [{} for _ in range(self.num_envs)]
self.actions = None

View file

@ -1 +1 @@
0.11.0a6
0.11.0a7