diff --git a/sota-implementations/a2c/a2c_atari.py b/sota-implementations/a2c/a2c_atari.py index 66d2780b66c..c7f70308fd4 100644 --- a/sota-implementations/a2c/a2c_atari.py +++ b/sota-implementations/a2c/a2c_atari.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import warnings import hydra diff --git a/sota-implementations/a2c/a2c_mujoco.py b/sota-implementations/a2c/a2c_mujoco.py index f857cce1c6f..cf88e7db01a 100644 --- a/sota-implementations/a2c/a2c_mujoco.py +++ b/sota-implementations/a2c/a2c_mujoco.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import warnings import hydra diff --git a/sota-implementations/a2c/utils_atari.py b/sota-implementations/a2c/utils_atari.py index dee5d5f719b..0397f7dc5f3 100644 --- a/sota-implementations/a2c/utils_atari.py +++ b/sota-implementations/a2c/utils_atari.py @@ -2,6 +2,7 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations import numpy as np import torch.nn diff --git a/sota-implementations/a2c/utils_mujoco.py b/sota-implementations/a2c/utils_mujoco.py index 953bf144080..b78f52b7eb4 100644 --- a/sota-implementations/a2c/utils_mujoco.py +++ b/sota-implementations/a2c/utils_mujoco.py @@ -2,6 +2,7 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations import numpy as np import torch.nn diff --git a/sota-implementations/bandits/dqn.py b/sota-implementations/bandits/dqn.py index 55ba34f5010..37cde0e2c62 100644 --- a/sota-implementations/bandits/dqn.py +++ b/sota-implementations/bandits/dqn.py @@ -2,6 +2,7 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations import argparse diff --git a/sota-implementations/cql/cql_offline.py b/sota-implementations/cql/cql_offline.py index 8841900b5eb..e74997eb37f 100644 --- a/sota-implementations/cql/cql_offline.py +++ b/sota-implementations/cql/cql_offline.py @@ -9,6 +9,8 @@ The helper functions are coded in the utils.py associated with this script. """ +from __future__ import annotations + import time import warnings diff --git a/sota-implementations/cql/cql_online.py b/sota-implementations/cql/cql_online.py index 94c8fe08096..61a19894ce0 100644 --- a/sota-implementations/cql/cql_online.py +++ b/sota-implementations/cql/cql_online.py @@ -11,6 +11,8 @@ The helper functions are coded in the utils.py associated with this script. """ +from __future__ import annotations + import warnings import hydra diff --git a/sota-implementations/cql/discrete_cql_online.py b/sota-implementations/cql/discrete_cql_online.py index 661d3e44bbb..c5a06b4b156 100644 --- a/sota-implementations/cql/discrete_cql_online.py +++ b/sota-implementations/cql/discrete_cql_online.py @@ -10,6 +10,8 @@ The helper functions are coded in the utils.py associated with this script. """ +from __future__ import annotations + import warnings import hydra diff --git a/sota-implementations/cql/utils.py b/sota-implementations/cql/utils.py index 5abd65f8c0f..306f1cdb7f1 100644 --- a/sota-implementations/cql/utils.py +++ b/sota-implementations/cql/utils.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import functools import torch.nn diff --git a/sota-implementations/crossq/crossq.py b/sota-implementations/crossq/crossq.py index 4f079549137..a0068b6662e 100644 --- a/sota-implementations/crossq/crossq.py +++ b/sota-implementations/crossq/crossq.py @@ -10,6 +10,8 @@ The helper functions are coded in the utils.py associated with this script. """ +from __future__ import annotations + import warnings import hydra diff --git a/sota-implementations/crossq/utils.py b/sota-implementations/crossq/utils.py index 86058532864..b124a619ea0 100644 --- a/sota-implementations/crossq/utils.py +++ b/sota-implementations/crossq/utils.py @@ -2,6 +2,7 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations import torch from tensordict.nn import InteractionType, TensorDictModule diff --git a/sota-implementations/ddpg/ddpg.py b/sota-implementations/ddpg/ddpg.py index 59e49ec1a0d..c3e3c9eb835 100644 --- a/sota-implementations/ddpg/ddpg.py +++ b/sota-implementations/ddpg/ddpg.py @@ -10,6 +10,8 @@ The helper functions are coded in the utils.py associated with this script. """ +from __future__ import annotations + import warnings import hydra diff --git a/sota-implementations/ddpg/utils.py b/sota-implementations/ddpg/utils.py index bb2f215115f..6083fb7f972 100644 --- a/sota-implementations/ddpg/utils.py +++ b/sota-implementations/ddpg/utils.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import functools import torch diff --git a/sota-implementations/decision_transformer/dt.py b/sota-implementations/decision_transformer/dt.py index dfb438efd1c..6ac058b9843 100644 --- a/sota-implementations/decision_transformer/dt.py +++ b/sota-implementations/decision_transformer/dt.py @@ -7,6 +7,8 @@ The helper functions are coded in the utils.py associated with this script. """ +from __future__ import annotations + import warnings import hydra diff --git a/sota-implementations/decision_transformer/lamb.py b/sota-implementations/decision_transformer/lamb.py index 69468d1ad86..5118f8a2721 100644 --- a/sota-implementations/decision_transformer/lamb.py +++ b/sota-implementations/decision_transformer/lamb.py @@ -3,6 +3,8 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # Lamb optimizer directly copied from https://github.com/facebookresearch/online-dt +from __future__ import annotations + import math import torch diff --git a/sota-implementations/decision_transformer/online_dt.py b/sota-implementations/decision_transformer/online_dt.py index 84732614e99..9f3ec5f8134 100644 --- a/sota-implementations/decision_transformer/online_dt.py +++ b/sota-implementations/decision_transformer/online_dt.py @@ -6,6 +6,8 @@ This is a self-contained example of an Online Decision Transformer training script. The helper functions are coded in the utils.py associated with this script. """ +from __future__ import annotations + import time import warnings diff --git a/sota-implementations/decision_transformer/utils.py b/sota-implementations/decision_transformer/utils.py index 79f5454a87d..5f14734addd 100644 --- a/sota-implementations/decision_transformer/utils.py +++ b/sota-implementations/decision_transformer/utils.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import os from pathlib import Path diff --git a/sota-implementations/discrete_sac/discrete_sac.py b/sota-implementations/discrete_sac/discrete_sac.py index 8b3efe15102..c88206e1330 100644 --- a/sota-implementations/discrete_sac/discrete_sac.py +++ b/sota-implementations/discrete_sac/discrete_sac.py @@ -11,6 +11,8 @@ The helper functions are coded in the utils.py associated with this script. """ +from __future__ import annotations + import warnings import hydra diff --git a/sota-implementations/discrete_sac/utils.py b/sota-implementations/discrete_sac/utils.py index 7055a00674b..6817fc50a56 100644 --- a/sota-implementations/discrete_sac/utils.py +++ b/sota-implementations/discrete_sac/utils.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import functools import tempfile from contextlib import nullcontext diff --git a/sota-implementations/dqn/dqn_atari.py b/sota-implementations/dqn/dqn_atari.py index 5c5c5ab8db5..d8e5047e8b3 100644 --- a/sota-implementations/dqn/dqn_atari.py +++ b/sota-implementations/dqn/dqn_atari.py @@ -7,6 +7,8 @@ DQN: Reproducing experimental results from Mnih et al. 2015 for the Deep Q-Learning Algorithm on Atari Environments. """ +from __future__ import annotations + import tempfile import warnings diff --git a/sota-implementations/dqn/dqn_cartpole.py b/sota-implementations/dqn/dqn_cartpole.py index 4611b9d1d63..e51a538d882 100644 --- a/sota-implementations/dqn/dqn_cartpole.py +++ b/sota-implementations/dqn/dqn_cartpole.py @@ -3,6 +3,8 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import warnings import hydra diff --git a/sota-implementations/dqn/utils_atari.py b/sota-implementations/dqn/utils_atari.py index 6f39e824c60..1e5440a54b6 100644 --- a/sota-implementations/dqn/utils_atari.py +++ b/sota-implementations/dqn/utils_atari.py @@ -2,6 +2,7 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations import torch.nn import torch.optim diff --git a/sota-implementations/dqn/utils_cartpole.py b/sota-implementations/dqn/utils_cartpole.py index c7f7491ad15..d378f1ec76b 100644 --- a/sota-implementations/dqn/utils_cartpole.py +++ b/sota-implementations/dqn/utils_cartpole.py @@ -2,6 +2,7 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations import torch.nn import torch.optim diff --git a/sota-implementations/dreamer/dreamer.py b/sota-implementations/dreamer/dreamer.py index 1b9823c1dd1..0db55b3ee00 100644 --- a/sota-implementations/dreamer/dreamer.py +++ b/sota-implementations/dreamer/dreamer.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import contextlib import time diff --git a/sota-implementations/dreamer/dreamer_utils.py b/sota-implementations/dreamer/dreamer_utils.py index 7f3fd663976..532fe4e1fe9 100644 --- a/sota-implementations/dreamer/dreamer_utils.py +++ b/sota-implementations/dreamer/dreamer_utils.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import functools import tempfile from contextlib import nullcontext diff --git a/sota-implementations/gail/gail.py b/sota-implementations/gail/gail.py index d8187e68635..d7b3dd49fcb 100644 --- a/sota-implementations/gail/gail.py +++ b/sota-implementations/gail/gail.py @@ -9,6 +9,8 @@ The helper functions for gail are coded in the gail_utils.py and helper functions for ppo in ppo_utils. """ +from __future__ import annotations + import hydra import numpy as np import torch diff --git a/sota-implementations/gail/gail_utils.py b/sota-implementations/gail/gail_utils.py index 067e9c8c927..ce09292cc47 100644 --- a/sota-implementations/gail/gail_utils.py +++ b/sota-implementations/gail/gail_utils.py @@ -2,6 +2,7 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations import torch.nn as nn import torch.optim diff --git a/sota-implementations/gail/ppo_utils.py b/sota-implementations/gail/ppo_utils.py index d90b58d35f9..b5f43a10899 100644 --- a/sota-implementations/gail/ppo_utils.py +++ b/sota-implementations/gail/ppo_utils.py @@ -2,6 +2,7 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations import torch.nn import torch.optim diff --git a/sota-implementations/impala/impala_multi_node_ray.py b/sota-implementations/impala/impala_multi_node_ray.py index 0dc033d6dd1..ba40de1acde 100644 --- a/sota-implementations/impala/impala_multi_node_ray.py +++ b/sota-implementations/impala/impala_multi_node_ray.py @@ -7,6 +7,8 @@ This script reproduces the IMPALA Algorithm results from Espeholt et al. 2018 for the on Atari Environments. """ +from __future__ import annotations + import hydra from torchrl._utils import logger as torchrl_logger diff --git a/sota-implementations/impala/impala_multi_node_submitit.py b/sota-implementations/impala/impala_multi_node_submitit.py index 33df035c20e..5f77008a12b 100644 --- a/sota-implementations/impala/impala_multi_node_submitit.py +++ b/sota-implementations/impala/impala_multi_node_submitit.py @@ -7,6 +7,8 @@ This script reproduces the IMPALA Algorithm results from Espeholt et al. 2018 for the on Atari Environments. """ +from __future__ import annotations + import hydra from torchrl._utils import logger as torchrl_logger diff --git a/sota-implementations/impala/impala_single_node.py b/sota-implementations/impala/impala_single_node.py index cc37df6c783..130d0d30dd7 100644 --- a/sota-implementations/impala/impala_single_node.py +++ b/sota-implementations/impala/impala_single_node.py @@ -7,6 +7,8 @@ This script reproduces the IMPALA Algorithm results from Espeholt et al. 2018 for the on Atari Environments. """ +from __future__ import annotations + import hydra from torchrl._utils import logger as torchrl_logger diff --git a/sota-implementations/impala/utils.py b/sota-implementations/impala/utils.py index d5f6157d237..738bb83bf55 100644 --- a/sota-implementations/impala/utils.py +++ b/sota-implementations/impala/utils.py @@ -2,6 +2,7 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations import torch.nn import torch.optim diff --git a/sota-implementations/iql/discrete_iql.py b/sota-implementations/iql/discrete_iql.py index ae1894379fd..79cf2114d40 100644 --- a/sota-implementations/iql/discrete_iql.py +++ b/sota-implementations/iql/discrete_iql.py @@ -11,6 +11,8 @@ The helper functions are coded in the utils.py associated with this script. """ +from __future__ import annotations + import time import hydra diff --git a/sota-implementations/iql/iql_offline.py b/sota-implementations/iql/iql_offline.py index 53581782d20..09cf9954b86 100644 --- a/sota-implementations/iql/iql_offline.py +++ b/sota-implementations/iql/iql_offline.py @@ -9,6 +9,8 @@ The helper functions are coded in the utils.py associated with this script. """ +from __future__ import annotations + import time import hydra diff --git a/sota-implementations/iql/iql_online.py b/sota-implementations/iql/iql_online.py index 3cdff06ffa2..8497d24f106 100644 --- a/sota-implementations/iql/iql_online.py +++ b/sota-implementations/iql/iql_online.py @@ -11,6 +11,8 @@ The helper functions are coded in the utils.py associated with this script. """ +from __future__ import annotations + import time import hydra diff --git a/sota-implementations/iql/utils.py b/sota-implementations/iql/utils.py index e342ba9281a..261cb912de0 100644 --- a/sota-implementations/iql/utils.py +++ b/sota-implementations/iql/utils.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import functools import torch.nn diff --git a/sota-implementations/multiagent/iql.py b/sota-implementations/multiagent/iql.py index 66cc3b6659e..2692c1c24b5 100644 --- a/sota-implementations/multiagent/iql.py +++ b/sota-implementations/multiagent/iql.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import time import hydra diff --git a/sota-implementations/multiagent/maddpg_iddpg.py b/sota-implementations/multiagent/maddpg_iddpg.py index 1485e3e8c0b..f04ccb19071 100644 --- a/sota-implementations/multiagent/maddpg_iddpg.py +++ b/sota-implementations/multiagent/maddpg_iddpg.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import time import hydra diff --git a/sota-implementations/multiagent/mappo_ippo.py b/sota-implementations/multiagent/mappo_ippo.py index 06cc2cd1fce..924ea12272a 100644 --- a/sota-implementations/multiagent/mappo_ippo.py +++ b/sota-implementations/multiagent/mappo_ippo.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import time import hydra diff --git a/sota-implementations/multiagent/qmix_vdn.py b/sota-implementations/multiagent/qmix_vdn.py index 1bcc2dbd10e..a832a29e6dd 100644 --- a/sota-implementations/multiagent/qmix_vdn.py +++ b/sota-implementations/multiagent/qmix_vdn.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import time import hydra diff --git a/sota-implementations/multiagent/sac.py b/sota-implementations/multiagent/sac.py index 694083e5b0f..31106bdd2a0 100644 --- a/sota-implementations/multiagent/sac.py +++ b/sota-implementations/multiagent/sac.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import time import hydra diff --git a/sota-implementations/multiagent/utils/logging.py b/sota-implementations/multiagent/utils/logging.py index cb6df4de7ea..e19ae8d78f7 100644 --- a/sota-implementations/multiagent/utils/logging.py +++ b/sota-implementations/multiagent/utils/logging.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import os import numpy as np diff --git a/sota-implementations/multiagent/utils/utils.py b/sota-implementations/multiagent/utils/utils.py index d21bafdf691..e2513f30aa7 100644 --- a/sota-implementations/multiagent/utils/utils.py +++ b/sota-implementations/multiagent/utils/utils.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + from tensordict import unravel_key from torchrl.envs import Transform diff --git a/sota-implementations/ppo/ppo_atari.py b/sota-implementations/ppo/ppo_atari.py index 30a19a64d6e..7878a0286e3 100644 --- a/sota-implementations/ppo/ppo_atari.py +++ b/sota-implementations/ppo/ppo_atari.py @@ -7,6 +7,8 @@ This script reproduces the Proximal Policy Optimization (PPO) Algorithm results from Schulman et al. 2017 for the Atari Environments. """ +from __future__ import annotations + import hydra from torchrl._utils import logger as torchrl_logger from torchrl.record import VideoRecorder diff --git a/sota-implementations/ppo/ppo_mujoco.py b/sota-implementations/ppo/ppo_mujoco.py index b98285f0726..c1d6fe52585 100644 --- a/sota-implementations/ppo/ppo_mujoco.py +++ b/sota-implementations/ppo/ppo_mujoco.py @@ -7,6 +7,8 @@ This script reproduces the Proximal Policy Optimization (PPO) Algorithm results from Schulman et al. 2017 for the on MuJoCo Environments. """ +from __future__ import annotations + import hydra from torchrl._utils import logger as torchrl_logger from torchrl.record import VideoRecorder diff --git a/sota-implementations/ppo/utils_atari.py b/sota-implementations/ppo/utils_atari.py index ec9cc3cd1d5..755c6311729 100644 --- a/sota-implementations/ppo/utils_atari.py +++ b/sota-implementations/ppo/utils_atari.py @@ -2,6 +2,7 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations import torch.nn import torch.optim diff --git a/sota-implementations/ppo/utils_mujoco.py b/sota-implementations/ppo/utils_mujoco.py index f2966ebcc7f..e7eb4534c45 100644 --- a/sota-implementations/ppo/utils_mujoco.py +++ b/sota-implementations/ppo/utils_mujoco.py @@ -2,6 +2,7 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations import torch.nn import torch.optim diff --git a/sota-implementations/redq/redq.py b/sota-implementations/redq/redq.py index 0732bf5f3b4..3dec888145c 100644 --- a/sota-implementations/redq/redq.py +++ b/sota-implementations/redq/redq.py @@ -2,6 +2,7 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations import uuid from datetime import datetime diff --git a/sota-implementations/sac/sac.py b/sota-implementations/sac/sac.py index a99094cf715..ee3e7d08df0 100644 --- a/sota-implementations/sac/sac.py +++ b/sota-implementations/sac/sac.py @@ -10,6 +10,8 @@ The helper functions are coded in the utils.py associated with this script. """ +from __future__ import annotations + import time import hydra diff --git a/sota-implementations/sac/utils.py b/sota-implementations/sac/utils.py index e827e4e6416..6d37f5ec3d8 100644 --- a/sota-implementations/sac/utils.py +++ b/sota-implementations/sac/utils.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import functools import torch diff --git a/sota-implementations/td3/td3.py b/sota-implementations/td3/td3.py index 01a59686ac9..70333f56cd9 100644 --- a/sota-implementations/td3/td3.py +++ b/sota-implementations/td3/td3.py @@ -10,6 +10,8 @@ The helper functions are coded in the utils.py associated with this script. """ +from __future__ import annotations + import time import hydra diff --git a/sota-implementations/td3/utils.py b/sota-implementations/td3/utils.py index d32375a7649..df81a522b3c 100644 --- a/sota-implementations/td3/utils.py +++ b/sota-implementations/td3/utils.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import functools import tempfile from contextlib import nullcontext diff --git a/sota-implementations/td3_bc/td3_bc.py b/sota-implementations/td3_bc/td3_bc.py index 930ff509488..75be949df90 100644 --- a/sota-implementations/td3_bc/td3_bc.py +++ b/sota-implementations/td3_bc/td3_bc.py @@ -9,6 +9,8 @@ The helper functions are coded in the utils.py associated with this script. """ +from __future__ import annotations + import time import hydra diff --git a/sota-implementations/td3_bc/utils.py b/sota-implementations/td3_bc/utils.py index 582afaaac04..d0c3161861d 100644 --- a/sota-implementations/td3_bc/utils.py +++ b/sota-implementations/td3_bc/utils.py @@ -2,6 +2,8 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +from __future__ import annotations + import functools import torch