mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-07-30 20:18:15 +00:00
Bump version and fix
This commit is contained in:
parent
c3187604bc
commit
b37c23c149
7 changed files with 10 additions and 9 deletions
5
setup.py
5
setup.py
|
|
@ -10,6 +10,7 @@ setup(name='torchy_baselines',
|
|||
'gym[classic_control]>=0.11',
|
||||
'numpy',
|
||||
'torch>=1.4.0',
|
||||
# For saving models
|
||||
'cloudpickle',
|
||||
# For reading logs
|
||||
'pandas',
|
||||
|
|
@ -31,7 +32,7 @@ setup(name='torchy_baselines',
|
|||
# For spelling
|
||||
'sphinxcontrib.spelling',
|
||||
# Type hints support
|
||||
'sphinx-autodoc-typehints'
|
||||
# 'sphinx-autodoc-typehints'
|
||||
],
|
||||
'extra': [
|
||||
# For render
|
||||
|
|
@ -47,7 +48,7 @@ setup(name='torchy_baselines',
|
|||
license="MIT",
|
||||
long_description="",
|
||||
long_description_content_type='text/markdown',
|
||||
version="0.2.3",
|
||||
version="0.2.4",
|
||||
)
|
||||
|
||||
# python setup.py sdist
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ from torchy_baselines.ppo import PPO
|
|||
from torchy_baselines.sac import SAC
|
||||
from torchy_baselines.td3 import TD3
|
||||
|
||||
__version__ = "0.2.3"
|
||||
__version__ = "0.2.4"
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ class BaseRLModel(ABC):
|
|||
low, high = self.action_space.low, self.action_space.high
|
||||
return low + (0.5 * (scaled_action + 1.0) * (high - low))
|
||||
|
||||
def _setup_learning_rate(self) -> None:
|
||||
def _setup_lr_schedule(self) -> None:
|
||||
"""Transform to callable if needed."""
|
||||
self.lr_schedule = get_schedule_fn(self.learning_rate)
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class PPOPolicy(BasePolicy):
|
|||
|
||||
:param observation_space: (gym.spaces.Space) Observation space
|
||||
:param action_space: (gym.spaces.Space) Action space
|
||||
:param lr_schedule: (callable) Learning rate schedule (could be constant)
|
||||
:param lr_schedule: (Callable) Learning rate schedule (could be constant)
|
||||
:param net_arch: ([int or dict]) The specification of the policy and value networks.
|
||||
:param device: (str or th.device) Device on which the code should run.
|
||||
:param activation_fn: (nn.Module) Activation function
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ class PPO(BaseRLModel):
|
|||
self._setup_model()
|
||||
|
||||
def _setup_model(self) -> None:
|
||||
self._setup_learning_rate()
|
||||
self._setup_lr_schedule()
|
||||
# TODO: preprocessing: one hot vector for obs discrete
|
||||
state_dim = self.observation_space.shape[0]
|
||||
if isinstance(self.action_space, spaces.Box):
|
||||
|
|
@ -137,7 +137,7 @@ class PPO(BaseRLModel):
|
|||
self.rollout_buffer = RolloutBuffer(self.n_steps, state_dim, action_dim, self.device,
|
||||
gamma=self.gamma, gae_lambda=self.gae_lambda, n_envs=self.n_envs)
|
||||
self.policy = self.policy_class(self.observation_space, self.action_space,
|
||||
self.learning_rate, use_sde=self.use_sde, device=self.device,
|
||||
self.lr_schedule, use_sde=self.use_sde, device=self.device,
|
||||
**self.policy_kwargs)
|
||||
self.policy = self.policy.to(self.device)
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ class SAC(OffPolicyRLModel):
|
|||
self._setup_model()
|
||||
|
||||
def _setup_model(self) -> None:
|
||||
self._setup_learning_rate()
|
||||
self._setup_lr_schedule()
|
||||
obs_dim, action_dim = self.observation_space.shape[0], self.action_space.shape[0]
|
||||
if self.seed is not None:
|
||||
self.set_random_seed(self.seed)
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ class TD3(OffPolicyRLModel):
|
|||
self._setup_model()
|
||||
|
||||
def _setup_model(self) -> None:
|
||||
self._setup_learning_rate()
|
||||
self._setup_lr_schedule()
|
||||
obs_dim, action_dim = self.observation_space.shape[0], self.action_space.shape[0]
|
||||
self.set_random_seed(self.seed)
|
||||
self.replay_buffer = ReplayBuffer(self.buffer_size, obs_dim, action_dim, self.device)
|
||||
|
|
|
|||
Loading…
Reference in a new issue