mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-07-30 20:18:15 +00:00
Fix various typos (#1926)
* Fix various typos * Update changelog --------- Co-authored-by: Antonin Raffin <antonin.raffin@ensta.org>
This commit is contained in:
parent
766b9e9f7d
commit
4317c62598
23 changed files with 32 additions and 31 deletions
|
|
@ -192,7 +192,7 @@ All the following examples can be executed online using Google Colab notebooks:
|
|||
<b id="f1">1</b>: Implemented in [SB3 Contrib](https://github.com/Stable-Baselines-Team/stable-baselines3-contrib) GitHub repository.
|
||||
|
||||
Actions `gym.spaces`:
|
||||
* `Box`: A N-dimensional box that containes every point in the action space.
|
||||
* `Box`: A N-dimensional box that contains every point in the action space.
|
||||
* `Discrete`: A list of possible actions, where each timestep only one of the actions can be used.
|
||||
* `MultiDiscrete`: A list of possible actions, where each timestep only one action of each discrete set can be used.
|
||||
* `MultiBinary`: A list of possible actions, where each timestep any of the actions can be used in any combination.
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ Multiprocessing: Unleashing the Power of Vectorized Environments
|
|||
|
||||
:param env_id: the environment ID
|
||||
:param num_env: the number of environments you wish to have in subprocesses
|
||||
:param seed: the inital seed for RNG
|
||||
:param seed: the initial seed for RNG
|
||||
:param rank: index of the subprocess
|
||||
"""
|
||||
def _init():
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ Deprecations:
|
|||
|
||||
Others:
|
||||
^^^^^^^
|
||||
- Fix various typos (@cschindlbeck)
|
||||
|
||||
Bug Fixes:
|
||||
^^^^^^^^^^
|
||||
|
|
@ -403,7 +404,7 @@ Breaking Changes:
|
|||
^^^^^^^^^^^^^^^^^
|
||||
- Removed shared layers in ``mlp_extractor`` (@AlexPasqua)
|
||||
- Refactored ``StackedObservations`` (it now handles dict obs, ``StackedDictObservations`` was removed)
|
||||
- You must now explicitely pass a ``features_extractor`` parameter when calling ``extract_features()``
|
||||
- You must now explicitly pass a ``features_extractor`` parameter when calling ``extract_features()``
|
||||
- Dropped offline sampling for ``HerReplayBuffer``
|
||||
- As ``HerReplayBuffer`` was refactored to support multiprocessing, previous replay buffer are incompatible with this new version
|
||||
- ``HerReplayBuffer`` doesn't require a ``max_episode_length`` anymore
|
||||
|
|
@ -535,7 +536,7 @@ Bug Fixes:
|
|||
|
||||
Deprecations:
|
||||
^^^^^^^^^^^^^
|
||||
- You should now explicitely pass a ``features_extractor`` parameter when calling ``extract_features()``
|
||||
- You should now explicitly pass a ``features_extractor`` parameter when calling ``extract_features()``
|
||||
- Deprecated shared layers in ``MlpExtractor`` (@AlexPasqua)
|
||||
|
||||
Others:
|
||||
|
|
@ -746,7 +747,7 @@ Bug Fixes:
|
|||
- Fixed a bug in ``HumanOutputFormat``. Distinct keys truncated to the same prefix would overwrite each others value,
|
||||
resulting in only one being output. This now raises an error (this should only affect a small fraction of use cases
|
||||
with very long keys.)
|
||||
- Routing all the ``nn.Module`` calls through implicit rather than explict forward as per pytorch guidelines (@manuel-delverme)
|
||||
- Routing all the ``nn.Module`` calls through implicit rather than explicit forward as per pytorch guidelines (@manuel-delverme)
|
||||
- Fixed a bug in ``VecNormalize`` where error occurs when ``norm_obs`` is set to False for environment with dictionary observation (@buoyancy99)
|
||||
- Set default ``env`` argument to ``None`` in ``HerReplayBuffer.sample`` (@qgallouedec)
|
||||
- Fix ``batch_size`` typing in ``DQN`` (@qgallouedec)
|
||||
|
|
@ -1658,4 +1659,4 @@ And all the contributors:
|
|||
@anand-bala @hughperkins @sidney-tio @AlexPasqua @dominicgkerr @Akhilez @Rocamonde @tobirohrer @ZikangXiong @ReHoss
|
||||
@DavyMorgan @luizapozzobon @Bonifatius94 @theSquaredError @harveybellini @DavyMorgan @FieteO @jonasreiher @npit @WeberSamuel @troiganto
|
||||
@lutogniew @lbergmann1 @lukashass @BertrandDecoster @pseudo-rnd-thoughts @stefanbschneider @kyle-he @PatrickHelm @corentinlger
|
||||
@marekm4 @stagoverflow @rushitnshah @markscsmith @NickLucche
|
||||
@marekm4 @stagoverflow @rushitnshah @markscsmith @NickLucche @cschindlbeck
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ def maybe_make_env(env: Union[GymEnv, str], verbose: int) -> GymEnv:
|
|||
"""If env is a string, make the environment; otherwise, return env.
|
||||
|
||||
:param env: The environment to learn from.
|
||||
:param verbose: Verbosity level: 0 for no output, 1 for indicating if envrironment is created
|
||||
:param verbose: Verbosity level: 0 for no output, 1 for indicating if environment is created
|
||||
:return A Gym (vector) environment.
|
||||
"""
|
||||
if isinstance(env, str):
|
||||
|
|
|
|||
|
|
@ -606,7 +606,7 @@ class StopTrainingOnMaxEpisodes(BaseCallback):
|
|||
self.n_episodes = 0
|
||||
|
||||
def _init_callback(self) -> None:
|
||||
# At start set total max according to number of envirnments
|
||||
# At start set total max according to number of environments
|
||||
self._total_max_episodes = self.max_episodes * self.training_env.num_envs
|
||||
|
||||
def _on_step(self) -> bool:
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ def _check_render(env: gym.Env, warn: bool = False) -> None: # pragma: no cover
|
|||
"you may have trouble when calling `.render()`"
|
||||
)
|
||||
|
||||
# Only check currrent render mode
|
||||
# Only check current render mode
|
||||
if env.render_mode:
|
||||
env.render()
|
||||
env.close()
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ class ResultsWriter:
|
|||
filename = os.path.realpath(filename)
|
||||
# Create (if any) missing filename directories
|
||||
os.makedirs(os.path.dirname(filename), exist_ok=True)
|
||||
# Append mode when not overridding existing file
|
||||
# Append mode when not overriding existing file
|
||||
mode = "w" if override_existing else "a"
|
||||
# Prevent newline issue on Windows, see GH issue #692
|
||||
self.file_handler = open(filename, f"{mode}t", newline="\n")
|
||||
|
|
|
|||
|
|
@ -922,7 +922,7 @@ class ContinuousCritic(BaseModel):
|
|||
By default, it creates two critic networks used to reduce overestimation
|
||||
thanks to clipped Q-learning (cf TD3 paper).
|
||||
|
||||
:param observation_space: Obervation space
|
||||
:param observation_space: Observation space
|
||||
:param action_space: Action space
|
||||
:param net_arch: Network architecture
|
||||
:param features_extractor: Network to extract features
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ def window_func(var_1: np.ndarray, var_2: np.ndarray, window: int, func: Callabl
|
|||
|
||||
def ts2xy(data_frame: pd.DataFrame, x_axis: str) -> Tuple[np.ndarray, np.ndarray]:
|
||||
"""
|
||||
Decompose a data frame variable to x ans ys
|
||||
Decompose a data frame variable to x and ys
|
||||
|
||||
:param data_frame: the input data
|
||||
:param x_axis: the axis for the x and y output
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import numpy as np
|
|||
class RunningMeanStd:
|
||||
def __init__(self, epsilon: float = 1e-4, shape: Tuple[int, ...] = ()):
|
||||
"""
|
||||
Calulates the running mean and std of a data stream
|
||||
Calculates the running mean and std of a data stream
|
||||
https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
|
||||
|
||||
:param epsilon: helps with arithmetic issues
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ class MlpExtractor(nn.Module):
|
|||
|
||||
# save dimensions of layers in policy and value nets
|
||||
if isinstance(net_arch, dict):
|
||||
# Note: if key is not specificed, assume linear network
|
||||
# Note: if key is not specified, assume linear network
|
||||
pi_layers_dims = net_arch.get("pi", []) # Layer sizes of the policy network
|
||||
vf_layers_dims = net_arch.get("vf", []) # Layer sizes of the value network
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ MaybeCallback = Union[None, Callable, List["BaseCallback"], "BaseCallback"]
|
|||
PyTorchObs = Union[th.Tensor, TensorDict]
|
||||
|
||||
# A schedule takes the remaining progress as input
|
||||
# and ouputs a scalar (e.g. learning rate, clip range, ...)
|
||||
# and outputs a scalar (e.g. learning rate, clip range, ...)
|
||||
Schedule = Callable[[float], float]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ def _convert_space(space: Union["gym.Space", gymnasium.Space]) -> gymnasium.Spac
|
|||
:return: Patched space (gymnasium Space)
|
||||
"""
|
||||
|
||||
# Gymnasium space, no convertion to be done
|
||||
# Gymnasium space, no conversion to be done
|
||||
if isinstance(space, gymnasium.Space):
|
||||
return space
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class VecNormalize(VecEnvWrapper):
|
|||
raise ValueError(
|
||||
f"VecNormalize only supports `gym.spaces.Box` observation spaces but {obs_key} "
|
||||
f"is of type {self.observation_space.spaces[obs_key]}. "
|
||||
"You should probably explicitely pass the observation keys "
|
||||
"You should probably explicitly pass the observation keys "
|
||||
" that should be normalized via the `norm_obs_keys` parameter."
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ class HerReplayBuffer(DictReplayBuffer):
|
|||
Get the samples corresponding to the batch and environment indices.
|
||||
|
||||
:param batch_indices: Indices of the transitions
|
||||
:param env_indices: Indices of the envrionments
|
||||
:param env_indices: Indices of the environments
|
||||
:param env: associated gym VecEnv to normalize the
|
||||
observations/rewards when sampling, defaults to None
|
||||
:return: Samples
|
||||
|
|
@ -294,7 +294,7 @@ class HerReplayBuffer(DictReplayBuffer):
|
|||
Get the samples, sample new desired goals and compute new rewards.
|
||||
|
||||
:param batch_indices: Indices of the transitions
|
||||
:param env_indices: Indices of the envrionments
|
||||
:param env_indices: Indices of the environments
|
||||
:param env: associated gym VecEnv to normalize the
|
||||
observations/rewards when sampling, defaults to None
|
||||
:return: Samples, with new desired goals and new rewards
|
||||
|
|
@ -357,7 +357,7 @@ class HerReplayBuffer(DictReplayBuffer):
|
|||
Sample goals based on goal_selection_strategy.
|
||||
|
||||
:param batch_indices: Indices of the transitions
|
||||
:param env_indices: Indices of the envrionments
|
||||
:param env_indices: Indices of the environments
|
||||
:return: Sampled goals
|
||||
"""
|
||||
batch_ep_start = self.ep_start[batch_indices, env_indices]
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Actor(BasePolicy):
|
|||
"""
|
||||
Actor network (policy) for SAC.
|
||||
|
||||
:param observation_space: Obervation space
|
||||
:param observation_space: Observation space
|
||||
:param action_space: Action space
|
||||
:param net_arch: Network architecture
|
||||
:param features_extractor: Network to extract features
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class Actor(BasePolicy):
|
|||
"""
|
||||
Actor network (policy) for TD3.
|
||||
|
||||
:param observation_space: Obervation space
|
||||
:param observation_space: Observation space
|
||||
:param action_space: Action space
|
||||
:param net_arch: Network architecture
|
||||
:param features_extractor: Network to extract features
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class DummyDictEnv(gym.Env):
|
|||
@pytest.mark.parametrize("env_cls", [DummyEnv, DummyDictEnv])
|
||||
def test_env(env_cls):
|
||||
# Check the env used for testing
|
||||
# Do not warn for assymetric space
|
||||
# Do not warn for asymmetric space
|
||||
check_env(env_cls(), warn=False, skip_render_check=True)
|
||||
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ def test_replay_buffer_normalization(replay_buffer_cls):
|
|||
|
||||
buffer = replay_buffer_cls(100, env.observation_space, env.action_space, device="cpu")
|
||||
|
||||
# Interract and store transitions
|
||||
# Interact and store transitions
|
||||
env.reset()
|
||||
obs = env.get_original_obs()
|
||||
for _ in range(100):
|
||||
|
|
@ -125,7 +125,7 @@ def test_device_buffer(replay_buffer_cls, device):
|
|||
|
||||
buffer = replay_buffer_cls(100, env.observation_space, env.action_space, device=device)
|
||||
|
||||
# Interract and store transitions
|
||||
# Interact and store transitions
|
||||
obs = env.reset()
|
||||
for _ in range(100):
|
||||
action = env.action_space.sample()
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ def test_features_extractor_target_net(model_class, share_features_extractor):
|
|||
if model_class == TD3:
|
||||
assert id(model.policy.actor_target.features_extractor) != id(model.policy.critic_target.features_extractor)
|
||||
|
||||
# Critic and target should be equal at the begginning of training
|
||||
# Critic and target should be equal at the beginning of training
|
||||
params_should_match(model.critic.parameters(), model.critic_target.parameters())
|
||||
|
||||
# TD3 has also a target actor net
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ def test_vec_normalize(model_class):
|
|||
|
||||
def test_dict_nested():
|
||||
"""
|
||||
Make sure we throw an appropiate error with nested Dict observation spaces
|
||||
Make sure we throw an appropriate error with nested Dict observation spaces
|
||||
"""
|
||||
# Test without manual wrapping to vec-env
|
||||
env = DummyDictEnv(nested_dict_obs=True)
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ def test_truncate_last_trajectory(n_envs, recwarn, n_steps, handle_timeout_termi
|
|||
# for all episodes that are not finished before truncate_last_trajectory: timeouts should be 1
|
||||
if handle_timeout_termination:
|
||||
assert (replay_buffer.timeouts[pos - 1, env_idx_not_finished] == 1).all()
|
||||
# episode length sould be != 0 -> episode can be sampled
|
||||
# episode length should be != 0 -> episode can be sampled
|
||||
assert (replay_buffer.ep_length[pos - 1] != 0).all()
|
||||
|
||||
# replay buffer should not have changed after truncate_last_trajectory (except dones[pos-1])
|
||||
|
|
|
|||
|
|
@ -479,7 +479,7 @@ def test_human_output_format_custom_test_io(base_class):
|
|||
|
||||
class DummySuccessEnv(gym.Env):
|
||||
"""
|
||||
Create a dummy success environment that returns wether True or False for info['is_success']
|
||||
Create a dummy success environment that returns whether True or False for info['is_success']
|
||||
at the end of an episode according to its dummy successes list
|
||||
"""
|
||||
|
||||
|
|
@ -536,7 +536,7 @@ def test_rollout_success_rate_on_policy_algorithm(tmp_path):
|
|||
Test if the rollout/success_rate information is correctly logged with on policy algorithms
|
||||
|
||||
To do so, create a dummy environment that takes as argument dummy successes (i.e when an episode)
|
||||
is going to be successfull or not.
|
||||
is going to be successful or not.
|
||||
"""
|
||||
|
||||
STATS_WINDOW_SIZE = 10
|
||||
|
|
|
|||
|
|
@ -484,7 +484,7 @@ def test_non_dict_obs_keys():
|
|||
with pytest.raises(ValueError, match=".*is applicable only.*"):
|
||||
_make_warmstart(lambda: DummyRewardEnv(), norm_obs_keys=["key"])
|
||||
|
||||
with pytest.raises(ValueError, match=".* explicitely pass the observation keys.*"):
|
||||
with pytest.raises(ValueError, match=".* explicitly pass the observation keys.*"):
|
||||
_make_warmstart(lambda: DummyMixedDictEnv())
|
||||
|
||||
# Ignore Discrete observation key
|
||||
|
|
|
|||
Loading…
Reference in a new issue