Skip to content

Commit e7583b3

Browse files
committed
[Typing] Edit wrongfully set str type annotations
ghstack-source-id: fbfb00f Pull-Request: #3169
1 parent 4ceec2c commit e7583b3

File tree

19 files changed

+42
-42
lines changed

19 files changed

+42
-42
lines changed

torchrl/envs/batched_envs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def __init__(
308308
num_sub_threads: int = 1,
309309
serial_for_single: bool = False,
310310
non_blocking: bool = False,
311-
mp_start_method: str = None,
311+
mp_start_method: str | None = None,
312312
use_buffers: bool | None = None,
313313
consolidate: bool = True,
314314
):

torchrl/envs/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2267,7 +2267,7 @@ def register_gym(
22672267
entry_point: Callable | None = None,
22682268
transform: Transform | None = None, # noqa: F821
22692269
info_keys: list[NestedKey] | None = None,
2270-
backend: str = None,
2270+
backend: str | None = None,
22712271
to_numpy: bool = False,
22722272
reward_threshold: float | None = None,
22732273
nondeterministic: bool = False,

torchrl/modules/llm/policies/transformers_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2460,7 +2460,7 @@ def __init__(
24602460
model,
24612461
max_concurrency: int = 16,
24622462
validate_model: bool = True,
2463-
actor_name: str = None,
2463+
actor_name: str | None = None,
24642464
num_gpus: int = 1,
24652465
num_cpus: int = 1,
24662466
**kwargs,

torchrl/objectives/a2c.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,12 @@ def __init__(
282282
loss_critic_type: str = "smooth_l1",
283283
gamma: float | None = None,
284284
separate_losses: bool = False,
285-
advantage_key: str = None,
286-
value_target_key: str = None,
285+
advantage_key: str | None = None,
286+
value_target_key: str | None = None,
287287
functional: bool = True,
288288
actor: ProbabilisticTensorDictSequential = None,
289289
critic: ProbabilisticTensorDictSequential = None,
290-
reduction: str = None,
290+
reduction: str | None = None,
291291
clip_value: float | None = None,
292292
**kwargs,
293293
):

torchrl/objectives/cql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def __init__(
291291
num_random: int = 10,
292292
with_lagrange: bool = False,
293293
lagrange_thresh: float = 0.0,
294-
reduction: str = None,
294+
reduction: str | None = None,
295295
deactivate_vmap: bool = False,
296296
) -> None:
297297
self._out_keys = None
@@ -1100,7 +1100,7 @@ def __init__(
11001100
delay_value: bool = True,
11011101
gamma: float | None = None,
11021102
action_space=None,
1103-
reduction: str = None,
1103+
reduction: str | None = None,
11041104
) -> None:
11051105
self._in_keys = None
11061106
if reduction is None:

torchrl/objectives/crossq.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,9 @@ def __init__(
266266
action_spec=None,
267267
fixed_alpha: bool = False,
268268
target_entropy: str | float = "auto",
269-
priority_key: str = None,
269+
priority_key: str | None = None,
270270
separate_losses: bool = False,
271-
reduction: str = None,
271+
reduction: str | None = None,
272272
deactivate_vmap: bool = False,
273273
) -> None:
274274
self._in_keys = None

torchrl/objectives/ddpg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def __init__(
201201
delay_value: bool = True,
202202
gamma: float | None = None,
203203
separate_losses: bool = False,
204-
reduction: str = None,
204+
reduction: str | None = None,
205205
) -> None:
206206
self._in_keys = None
207207
if reduction is None:

torchrl/objectives/decision_transformer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def __init__(
8585
fixed_alpha: bool = False,
8686
target_entropy: str | float = "auto",
8787
samples_mc_entropy: int = 1,
88-
reduction: str = None,
88+
reduction: str | None = None,
8989
) -> None:
9090
self._in_keys = None
9191
self._out_keys = None
@@ -296,7 +296,7 @@ def __init__(
296296
actor_network: ProbabilisticActor,
297297
*,
298298
loss_function: str = "l2",
299-
reduction: str = None,
299+
reduction: str | None = None,
300300
device: torch.device | None = None,
301301
) -> None:
302302
self._in_keys = None

torchrl/objectives/deprecated.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ def __init__(
163163
delay_qvalue: bool = True,
164164
gSDE: bool = False,
165165
gamma: float | None = None,
166-
priority_key: str = None,
166+
priority_key: str | None = None,
167167
separate_losses: bool = False,
168-
reduction: str = None,
168+
reduction: str | None = None,
169169
deactivate_vmap: bool = False,
170170
):
171171
self._in_keys = None

torchrl/objectives/dqn.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ def __init__(
179179
double_dqn: bool = False,
180180
gamma: float | None = None,
181181
action_space: str | TensorSpec = None,
182-
priority_key: str = None,
183-
reduction: str = None,
182+
priority_key: str | None = None,
183+
reduction: str | None = None,
184184
) -> None:
185185
if reduction is None:
186186
reduction = "mean"
@@ -455,8 +455,8 @@ def __init__(
455455
*,
456456
gamma: float,
457457
delay_value: bool = True,
458-
priority_key: str = None,
459-
reduction: str = None,
458+
priority_key: str | None = None,
459+
reduction: str | None = None,
460460
):
461461
if reduction is None:
462462
reduction = "mean"

0 commit comments

Comments
 (0)