diff --git a/README.md b/README.md index 018b8c6f3..78592bae8 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,7 @@ All the following examples can be executed online using Google Colab notebooks: 1: 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. diff --git a/docs/guide/examples.rst b/docs/guide/examples.rst index a4729bfb3..67a477769 100644 --- a/docs/guide/examples.rst +++ b/docs/guide/examples.rst @@ -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(): diff --git a/docs/misc/changelog.rst b/docs/misc/changelog.rst index 16712fb79..a4c333e08 100644 --- a/docs/misc/changelog.rst +++ b/docs/misc/changelog.rst @@ -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 diff --git a/stable_baselines3/common/base_class.py b/stable_baselines3/common/base_class.py index e6c7d3cfc..054e58a1f 100644 --- a/stable_baselines3/common/base_class.py +++ b/stable_baselines3/common/base_class.py @@ -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): diff --git a/stable_baselines3/common/callbacks.py b/stable_baselines3/common/callbacks.py index 2898df8f4..48b6011d1 100644 --- a/stable_baselines3/common/callbacks.py +++ b/stable_baselines3/common/callbacks.py @@ -606,7 +606,7 @@ def __init__(self, max_episodes: int, verbose: int = 0): 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: diff --git a/stable_baselines3/common/env_checker.py b/stable_baselines3/common/env_checker.py index f24c86ec9..090d609ba 100644 --- a/stable_baselines3/common/env_checker.py +++ b/stable_baselines3/common/env_checker.py @@ -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() diff --git a/stable_baselines3/common/monitor.py b/stable_baselines3/common/monitor.py index 5253954e8..fb8ce33c6 100644 --- a/stable_baselines3/common/monitor.py +++ b/stable_baselines3/common/monitor.py @@ -189,7 +189,7 @@ def __init__( 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") diff --git a/stable_baselines3/common/policies.py b/stable_baselines3/common/policies.py index e4d62ef0f..3c9b14aaa 100644 --- a/stable_baselines3/common/policies.py +++ b/stable_baselines3/common/policies.py @@ -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 diff --git a/stable_baselines3/common/results_plotter.py b/stable_baselines3/common/results_plotter.py index 1324557d1..f4c1a7a05 100644 --- a/stable_baselines3/common/results_plotter.py +++ b/stable_baselines3/common/results_plotter.py @@ -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 diff --git a/stable_baselines3/common/running_mean_std.py b/stable_baselines3/common/running_mean_std.py index 9dfa4b84c..ac3538c50 100644 --- a/stable_baselines3/common/running_mean_std.py +++ b/stable_baselines3/common/running_mean_std.py @@ -6,7 +6,7 @@ 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 diff --git a/stable_baselines3/common/torch_layers.py b/stable_baselines3/common/torch_layers.py index ad6c7eef1..bb3ba5de8 100644 --- a/stable_baselines3/common/torch_layers.py +++ b/stable_baselines3/common/torch_layers.py @@ -189,7 +189,7 @@ def __init__( # 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: diff --git a/stable_baselines3/common/type_aliases.py b/stable_baselines3/common/type_aliases.py index 85d09066e..042c66f9c 100644 --- a/stable_baselines3/common/type_aliases.py +++ b/stable_baselines3/common/type_aliases.py @@ -24,7 +24,7 @@ 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] diff --git a/stable_baselines3/common/vec_env/patch_gym.py b/stable_baselines3/common/vec_env/patch_gym.py index 2da76a9b2..6ba655ebf 100644 --- a/stable_baselines3/common/vec_env/patch_gym.py +++ b/stable_baselines3/common/vec_env/patch_gym.py @@ -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 diff --git a/stable_baselines3/common/vec_env/vec_normalize.py b/stable_baselines3/common/vec_env/vec_normalize.py index 391ce342d..ab1d8403a 100644 --- a/stable_baselines3/common/vec_env/vec_normalize.py +++ b/stable_baselines3/common/vec_env/vec_normalize.py @@ -111,7 +111,7 @@ def _sanity_checks(self) -> None: 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." ) diff --git a/stable_baselines3/her/her_replay_buffer.py b/stable_baselines3/her/her_replay_buffer.py index 5f0765884..579c6ebf1 100644 --- a/stable_baselines3/her/her_replay_buffer.py +++ b/stable_baselines3/her/her_replay_buffer.py @@ -255,7 +255,7 @@ def _get_real_samples( 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 @@ def _get_virtual_samples( 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 @@ def _sample_goals(self, batch_indices: np.ndarray, env_indices: np.ndarray) -> n 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] diff --git a/stable_baselines3/sac/policies.py b/stable_baselines3/sac/policies.py index 97d0ad94e..6185e2992 100644 --- a/stable_baselines3/sac/policies.py +++ b/stable_baselines3/sac/policies.py @@ -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 diff --git a/stable_baselines3/td3/policies.py b/stable_baselines3/td3/policies.py index dda6cb31a..a15be0396 100644 --- a/stable_baselines3/td3/policies.py +++ b/stable_baselines3/td3/policies.py @@ -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 diff --git a/tests/test_buffers.py b/tests/test_buffers.py index 2ea366aff..da6b44a34 100644 --- a/tests/test_buffers.py +++ b/tests/test_buffers.py @@ -74,7 +74,7 @@ def step(self, action): @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() diff --git a/tests/test_cnn.py b/tests/test_cnn.py index e32438c27..4ff31486b 100644 --- a/tests/test_cnn.py +++ b/tests/test_cnn.py @@ -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 diff --git a/tests/test_dict_env.py b/tests/test_dict_env.py index 14777452e..f093e47e7 100644 --- a/tests/test_dict_env.py +++ b/tests/test_dict_env.py @@ -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) diff --git a/tests/test_her.py b/tests/test_her.py index 79b0ac9c6..cb8bfb10f 100644 --- a/tests/test_her.py +++ b/tests/test_her.py @@ -384,7 +384,7 @@ def env_fn(): # 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]) diff --git a/tests/test_logger.py b/tests/test_logger.py index dfd9e5567..dfa3691ed 100644 --- a/tests/test_logger.py +++ b/tests/test_logger.py @@ -479,7 +479,7 @@ def get_printed(self) -> str: 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 diff --git a/tests/test_vec_normalize.py b/tests/test_vec_normalize.py index 2b30d5ad1..b7d71b748 100644 --- a/tests/test_vec_normalize.py +++ b/tests/test_vec_normalize.py @@ -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