Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion torchrl/envs/batched_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def __init__(
num_sub_threads: int = 1,
serial_for_single: bool = False,
non_blocking: bool = False,
mp_start_method: str = None,
mp_start_method: str | None = None,
use_buffers: bool | None = None,
consolidate: bool = True,
):
Expand Down
2 changes: 1 addition & 1 deletion torchrl/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,7 @@ def register_gym(
entry_point: Callable | None = None,
transform: Transform | None = None, # noqa: F821
info_keys: list[NestedKey] | None = None,
backend: str = None,
backend: str | None = None,
to_numpy: bool = False,
reward_threshold: float | None = None,
nondeterministic: bool = False,
Expand Down
2 changes: 1 addition & 1 deletion torchrl/modules/llm/policies/transformers_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2460,7 +2460,7 @@ def __init__(
model,
max_concurrency: int = 16,
validate_model: bool = True,
actor_name: str = None,
actor_name: str | None = None,
num_gpus: int = 1,
num_cpus: int = 1,
**kwargs,
Expand Down
6 changes: 3 additions & 3 deletions torchrl/objectives/a2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,12 @@ def __init__(
loss_critic_type: str = "smooth_l1",
gamma: float | None = None,
separate_losses: bool = False,
advantage_key: str = None,
value_target_key: str = None,
advantage_key: str | None = None,
value_target_key: str | None = None,
functional: bool = True,
actor: ProbabilisticTensorDictSequential = None,
critic: ProbabilisticTensorDictSequential = None,
reduction: str = None,
reduction: str | None = None,
clip_value: float | None = None,
**kwargs,
):
Expand Down
4 changes: 2 additions & 2 deletions torchrl/objectives/cql.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def __init__(
num_random: int = 10,
with_lagrange: bool = False,
lagrange_thresh: float = 0.0,
reduction: str = None,
reduction: str | None = None,
deactivate_vmap: bool = False,
) -> None:
self._out_keys = None
Expand Down Expand Up @@ -1100,7 +1100,7 @@ def __init__(
delay_value: bool = True,
gamma: float | None = None,
action_space=None,
reduction: str = None,
reduction: str | None = None,
) -> None:
self._in_keys = None
if reduction is None:
Expand Down
4 changes: 2 additions & 2 deletions torchrl/objectives/crossq.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ def __init__(
action_spec=None,
fixed_alpha: bool = False,
target_entropy: str | float = "auto",
priority_key: str = None,
priority_key: str | None = None,
separate_losses: bool = False,
reduction: str = None,
reduction: str | None = None,
deactivate_vmap: bool = False,
) -> None:
self._in_keys = None
Expand Down
2 changes: 1 addition & 1 deletion torchrl/objectives/ddpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def __init__(
delay_value: bool = True,
gamma: float | None = None,
separate_losses: bool = False,
reduction: str = None,
reduction: str | None = None,
) -> None:
self._in_keys = None
if reduction is None:
Expand Down
4 changes: 2 additions & 2 deletions torchrl/objectives/decision_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(
fixed_alpha: bool = False,
target_entropy: str | float = "auto",
samples_mc_entropy: int = 1,
reduction: str = None,
reduction: str | None = None,
) -> None:
self._in_keys = None
self._out_keys = None
Expand Down Expand Up @@ -296,7 +296,7 @@ def __init__(
actor_network: ProbabilisticActor,
*,
loss_function: str = "l2",
reduction: str = None,
reduction: str | None = None,
device: torch.device | None = None,
) -> None:
self._in_keys = None
Expand Down
4 changes: 2 additions & 2 deletions torchrl/objectives/deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ def __init__(
delay_qvalue: bool = True,
gSDE: bool = False,
gamma: float | None = None,
priority_key: str = None,
priority_key: str | None = None,
separate_losses: bool = False,
reduction: str = None,
reduction: str | None = None,
deactivate_vmap: bool = False,
):
self._in_keys = None
Expand Down
8 changes: 4 additions & 4 deletions torchrl/objectives/dqn.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ def __init__(
double_dqn: bool = False,
gamma: float | None = None,
action_space: str | TensorSpec = None,
priority_key: str = None,
reduction: str = None,
priority_key: str | None = None,
reduction: str | None = None,
) -> None:
if reduction is None:
reduction = "mean"
Expand Down Expand Up @@ -455,8 +455,8 @@ def __init__(
*,
gamma: float,
delay_value: bool = True,
priority_key: str = None,
reduction: str = None,
priority_key: str | None = None,
reduction: str | None = None,
):
if reduction is None:
reduction = "mean"
Expand Down
2 changes: 1 addition & 1 deletion torchrl/objectives/gail.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(
*,
use_grad_penalty: bool = False,
gp_lambda: float = 10,
reduction: str = None,
reduction: str | None = None,
) -> None:
self._in_keys = None
self._out_keys = None
Expand Down
8 changes: 4 additions & 4 deletions torchrl/objectives/iql.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ def __init__(
temperature: float = 1.0,
expectile: float = 0.5,
gamma: float | None = None,
priority_key: str = None,
priority_key: str | None = None,
separate_losses: bool = False,
reduction: str = None,
reduction: str | None = None,
deactivate_vmap: bool = False,
) -> None:
self._in_keys = None
Expand Down Expand Up @@ -785,9 +785,9 @@ def __init__(
temperature: float = 1.0,
expectile: float = 0.5,
gamma: float | None = None,
priority_key: str = None,
priority_key: str | None = None,
separate_losses: bool = False,
reduction: str = None,
reduction: str | None = None,
) -> None:
self._in_keys = None
self._out_keys = None
Expand Down
2 changes: 1 addition & 1 deletion torchrl/objectives/multiagent/qmixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def __init__(
delay_value: bool = True,
gamma: float | None = None,
action_space: str | TensorSpec = None,
priority_key: str = None,
priority_key: str | None = None,
) -> None:
super().__init__()
self._in_keys = None
Expand Down
4 changes: 2 additions & 2 deletions torchrl/objectives/redq.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ def __init__(
delay_qvalue: bool = True,
gSDE: bool = False,
gamma: float | None = None,
priority_key: str = None,
priority_key: str | None = None,
separate_losses: bool = False,
reduction: str = None,
reduction: str | None = None,
deactivate_vmap: bool = False,
):
if reduction is None:
Expand Down
6 changes: 3 additions & 3 deletions torchrl/objectives/reinforce.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ def __init__(
delay_value: bool = False,
loss_critic_type: str = "smooth_l1",
gamma: float | None = None,
advantage_key: str = None,
value_target_key: str = None,
advantage_key: str | None = None,
value_target_key: str | None = None,
separate_losses: bool = False,
functional: bool = True,
actor: ProbabilisticTensorDictSequential = None,
critic: ProbabilisticTensorDictSequential = None,
reduction: str = None,
reduction: str | None = None,
clip_value: float | None = None,
) -> None:
if actor is not None:
Expand Down
10 changes: 5 additions & 5 deletions torchrl/objectives/sac.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,16 +325,16 @@ def __init__(
alpha_init: float = 1.0,
min_alpha: float | None = None,
max_alpha: float | None = None,
action_spec=None,
action_spec: TensorSpec | None = None,
fixed_alpha: bool = False,
target_entropy: str | float = "auto",
delay_actor: bool = False,
delay_qvalue: bool = True,
delay_value: bool = True,
gamma: float | None = None,
priority_key: str = None,
priority_key: str | None = None,
separate_losses: bool = False,
reduction: str = None,
reduction: str | None = None,
skip_done_states: bool = False,
deactivate_vmap: bool = False,
) -> None:
Expand Down Expand Up @@ -1195,9 +1195,9 @@ def __init__(
target_entropy_weight: float = 0.98,
target_entropy: str | Number = "auto",
delay_qvalue: bool = True,
priority_key: str = None,
priority_key: str | None = None,
separate_losses: bool = False,
reduction: str = None,
reduction: str | None = None,
skip_done_states: bool = False,
deactivate_vmap: bool = False,
):
Expand Down
4 changes: 2 additions & 2 deletions torchrl/objectives/td3.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ def __init__(
delay_actor: bool = True,
delay_qvalue: bool = True,
gamma: float | None = None,
priority_key: str = None,
priority_key: str | None = None,
separate_losses: bool = False,
reduction: str = None,
reduction: str | None = None,
deactivate_vmap: bool = False,
) -> None:
if reduction is None:
Expand Down
4 changes: 2 additions & 2 deletions torchrl/objectives/td3_bc.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ def __init__(
loss_function: str = "smooth_l1",
delay_actor: bool = True,
delay_qvalue: bool = True,
priority_key: str = None,
priority_key: str | None = None,
separate_losses: bool = False,
reduction: str = None,
reduction: str | None = None,
deactivate_vmap: bool = False,
) -> None:
if reduction is None:
Expand Down
6 changes: 3 additions & 3 deletions torchrl/record/loggers/wandb.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ def __init__(
self,
exp_name: str,
offline: bool = False,
save_dir: str = None,
id: str = None,
project: str = None,
save_dir: str | None = None,
id: str | None = None,
project: str | None = None,
*,
video_fps: int = 32,
**kwargs,
Expand Down
Loading