Update defaults for offpolicy algos with features extractor (#935)

This commit is contained in:
Antonin RAFFIN 2022-06-18 10:52:52 +02:00 committed by GitHub
parent d68f0a2411
commit 7ce7b6a8c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 13 deletions

View file

@ -4,7 +4,7 @@ Changelog
==========
Release 1.5.1a8 (WIP)
Release 1.5.1a9 (WIP)
---------------------------
Breaking Changes:
@ -12,6 +12,8 @@ Breaking Changes:
- Changed the way policy "aliases" are handled ("MlpPolicy", "CnnPolicy", ...), removing the former
``register_policy`` helper, ``policy_base`` parameter and using ``policy_aliases`` static attributes instead (@Gregwar)
- SB3 now requires PyTorch >= 1.11
- Changed the default network architecture when using ``CnnPolicy`` or ``MultiInputPolicy`` with SAC or DDPG/TD3,
``share_features_extractor`` is now set to False by default and the ``net_arch=[256, 256]`` (instead of ``net_arch=[]`` that was before)
New Features:
^^^^^^^^^^^^^

View file

@ -235,7 +235,7 @@ class SACPolicy(BasePolicy):
optimizer_class: Type[th.optim.Optimizer] = th.optim.Adam,
optimizer_kwargs: Optional[Dict[str, Any]] = None,
n_critics: int = 2,
share_features_extractor: bool = True,
share_features_extractor: bool = False,
):
super().__init__(
observation_space,
@ -248,10 +248,7 @@ class SACPolicy(BasePolicy):
)
if net_arch is None:
if features_extractor_class == NatureCNN:
net_arch = []
else:
net_arch = [256, 256]
net_arch = [256, 256]
actor_arch, critic_arch = get_actor_critic_arch(net_arch)
@ -422,7 +419,7 @@ class CnnPolicy(SACPolicy):
optimizer_class: Type[th.optim.Optimizer] = th.optim.Adam,
optimizer_kwargs: Optional[Dict[str, Any]] = None,
n_critics: int = 2,
share_features_extractor: bool = True,
share_features_extractor: bool = False,
):
super().__init__(
observation_space,
@ -493,7 +490,7 @@ class MultiInputPolicy(SACPolicy):
optimizer_class: Type[th.optim.Optimizer] = th.optim.Adam,
optimizer_kwargs: Optional[Dict[str, Any]] = None,
n_critics: int = 2,
share_features_extractor: bool = True,
share_features_extractor: bool = False,
):
super().__init__(
observation_space,

View file

@ -119,7 +119,7 @@ class TD3Policy(BasePolicy):
optimizer_class: Type[th.optim.Optimizer] = th.optim.Adam,
optimizer_kwargs: Optional[Dict[str, Any]] = None,
n_critics: int = 2,
share_features_extractor: bool = True,
share_features_extractor: bool = False,
):
super().__init__(
observation_space,
@ -134,7 +134,7 @@ class TD3Policy(BasePolicy):
# Default network architecture, from the original paper
if net_arch is None:
if features_extractor_class == NatureCNN:
net_arch = []
net_arch = [256, 256]
else:
net_arch = [400, 300]
@ -281,7 +281,7 @@ class CnnPolicy(TD3Policy):
optimizer_class: Type[th.optim.Optimizer] = th.optim.Adam,
optimizer_kwargs: Optional[Dict[str, Any]] = None,
n_critics: int = 2,
share_features_extractor: bool = True,
share_features_extractor: bool = False,
):
super().__init__(
observation_space,
@ -335,7 +335,7 @@ class MultiInputPolicy(TD3Policy):
optimizer_class: Type[th.optim.Optimizer] = th.optim.Adam,
optimizer_kwargs: Optional[Dict[str, Any]] = None,
n_critics: int = 2,
share_features_extractor: bool = True,
share_features_extractor: bool = False,
):
super().__init__(
observation_space,

View file

@ -1 +1 @@
1.5.1a8
1.5.1a9