diff --git a/torchrl/collectors/collectors.py b/torchrl/collectors/collectors.py index 37e6032a72b..b8c2709b583 100644 --- a/torchrl/collectors/collectors.py +++ b/torchrl/collectors/collectors.py @@ -726,7 +726,7 @@ def __init__( warnings.warn( f"frames_per_batch ({frames_per_batch}) is not exactly divisible by the number of batched environments ({self.n_env}), " f" this results in more frames_per_batch per iteration that requested" - f" ({-(-frames_per_batch // self.n_env) * self.n_env})." + f" ({-(-frames_per_batch // self.n_env) * self.n_env}). " "To silence this message, set the environment variable RL_WARNINGS to False." ) self.requested_frames_per_batch = int(frames_per_batch) @@ -1645,8 +1645,8 @@ def __init__( remainder = total_frames % frames_per_batch if remainder != 0 and RL_WARNINGS: warnings.warn( - f"total_frames ({total_frames}) is not exactly divisible by frames_per_batch ({frames_per_batch})." - f"This means {frames_per_batch - remainder} additional frames will be collected." + f"total_frames ({total_frames}) is not exactly divisible by frames_per_batch ({frames_per_batch}). " + f"This means {frames_per_batch - remainder} additional frames will be collected. " "To silence this message, set the environment variable RL_WARNINGS to False." ) self.total_frames = ( diff --git a/torchrl/envs/common.py b/torchrl/envs/common.py index b6755212f98..cf784f5659d 100644 --- a/torchrl/envs/common.py +++ b/torchrl/envs/common.py @@ -3202,7 +3202,7 @@ def __init__( ) if len(args): raise ValueError( - "`_EnvWrapper.__init__` received a non-empty args list of arguments." + "`_EnvWrapper.__init__` received a non-empty args list of arguments. " "Make sure only keywords arguments are used when calling `super().__init__`." ) diff --git a/torchrl/envs/libs/gym.py b/torchrl/envs/libs/gym.py index dfe0db92230..e4cab0edc80 100644 --- a/torchrl/envs/libs/gym.py +++ b/torchrl/envs/libs/gym.py @@ -905,7 +905,7 @@ def _build_env( ) if isinstance(env, PixelObservationWrapper): raise TypeError( - "PixelObservationWrapper cannot be used to wrap an environment" + "PixelObservationWrapper cannot be used to wrap an environment " "that is already a PixelObservationWrapper instance." ) except ModuleNotFoundError: diff --git a/torchrl/envs/libs/meltingpot.py b/torchrl/envs/libs/meltingpot.py index b8e52031a23..66e83cd1d8c 100644 --- a/torchrl/envs/libs/meltingpot.py +++ b/torchrl/envs/libs/meltingpot.py @@ -344,7 +344,7 @@ def _init_env(self): def _set_seed(self, seed: int | None): raise NotImplementedError( - "It is currently unclear how to set a seed in Meltingpot" + "It is currently unclear how to set a seed in Meltingpot. " "see https://github.com/google-deepmind/meltingpot/issues/129 to track the issue." ) diff --git a/torchrl/modules/tensordict_module/actors.py b/torchrl/modules/tensordict_module/actors.py index bf945e609cb..2ad5918861d 100644 --- a/torchrl/modules/tensordict_module/actors.py +++ b/torchrl/modules/tensordict_module/actors.py @@ -1131,7 +1131,7 @@ def __init__( ): if isinstance(action_space, TensorSpec): raise RuntimeError( - "Using specs in action_space is deprecated." + "Using specs in action_space is deprecated. " "Please use the 'spec' argument if you want to provide an action spec" ) action_space, spec = _process_action_space_spec(action_space, spec) diff --git a/torchrl/objectives/dqn.py b/torchrl/objectives/dqn.py index 6cbb8b02426..72638893aa4 100644 --- a/torchrl/objectives/dqn.py +++ b/torchrl/objectives/dqn.py @@ -223,8 +223,8 @@ def __init__( ) if action_space is None: warnings.warn( - "action_space was not specified. DQNLoss will default to 'one-hot'." - "This behavior will be deprecated soon and a space will have to be passed." + "action_space was not specified. DQNLoss will default to 'one-hot'. " + "This behavior will be deprecated soon and a space will have to be passed. " "Check the DQNLoss documentation to see how to pass the action space. " ) action_space = "one-hot" diff --git a/torchrl/objectives/iql.py b/torchrl/objectives/iql.py index 88af015686b..71d1a22e17b 100644 --- a/torchrl/objectives/iql.py +++ b/torchrl/objectives/iql.py @@ -764,8 +764,8 @@ def __init__( ) if action_space is None: warnings.warn( - "action_space was not specified. DiscreteIQLLoss will default to 'one-hot'." - "This behavior will be deprecated soon and a space will have to be passed." + "action_space was not specified. DiscreteIQLLoss will default to 'one-hot'. " + "This behavior will be deprecated soon and a space will have to be passed. " "Check the DiscreteIQLLoss documentation to see how to pass the action space. " ) action_space = "one-hot" diff --git a/torchrl/objectives/sac.py b/torchrl/objectives/sac.py index 5cd89f1fa10..3fb34678d02 100644 --- a/torchrl/objectives/sac.py +++ b/torchrl/objectives/sac.py @@ -1092,7 +1092,7 @@ def __init__( if action_space is None: warnings.warn( - "action_space was not specified. DiscreteSACLoss will default to 'one-hot'." + "action_space was not specified. DiscreteSACLoss will default to 'one-hot'. " "This behavior will be deprecated soon and a space will have to be passed. " "Check the DiscreteSACLoss documentation to see how to pass the action space. " ) diff --git a/torchrl/record/recorder.py b/torchrl/record/recorder.py index e533f9e9df9..dfab11e5d35 100644 --- a/torchrl/record/recorder.py +++ b/torchrl/record/recorder.py @@ -199,7 +199,7 @@ def _apply_transform(self, observation: torch.Tensor) -> torch.Tensor: if self.center_crop: if not _has_tv: raise ImportError( - "Could not import torchvision, `center_crop` not available." + "Could not import torchvision, `center_crop` not available. " "Make sure torchvision is installed in your environment." ) from torchvision.transforms.functional import ( @@ -212,7 +212,7 @@ def _apply_transform(self, observation: torch.Tensor) -> torch.Tensor: if self.make_grid and observation_trsf.ndimension() >= 4: if not _has_tv: raise ImportError( - "Could not import torchvision, `make_grid` not available." + "Could not import torchvision, `make_grid` not available. " "Make sure torchvision is installed in your environment." ) from torchvision.utils import make_grid diff --git a/torchrl/trainers/helpers/envs.py b/torchrl/trainers/helpers/envs.py index 8dc8d478ddf..5e19887d443 100644 --- a/torchrl/trainers/helpers/envs.py +++ b/torchrl/trainers/helpers/envs.py @@ -116,7 +116,7 @@ def make_env_transforms( if from_pixels: if not cfg.catframes: raise RuntimeError( - "this env builder currently only accepts positive catframes values" + "this env builder currently only accepts positive catframes values " "when pixels are being used." ) env.append_transform(ToTensorImage())