From bd9206fae2de3b7308e1dda678e6a276869025aa Mon Sep 17 00:00:00 2001 From: Chenran Xu Date: Sun, 4 Feb 2024 23:23:52 +0100 Subject: [PATCH] apply isort --- meta-rl/maml_rl/envs/awake_steering_simulated.py | 9 ++------- meta-rl/maml_rl/metalearners/maml_trpo.py | 8 ++------ meta-rl/ppo.py | 3 ++- meta-rl/read_out_train.py | 3 ++- meta-rl/test.py | 3 ++- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/meta-rl/maml_rl/envs/awake_steering_simulated.py b/meta-rl/maml_rl/envs/awake_steering_simulated.py index 58735d2..fb2d9fc 100755 --- a/meta-rl/maml_rl/envs/awake_steering_simulated.py +++ b/meta-rl/maml_rl/envs/awake_steering_simulated.py @@ -14,13 +14,8 @@ from gymnasium import Wrapper, spaces from gymnasium.core import WrapperObsType -from maml_rl.envs.helpers import ( - Awake_Benchmarking_Wrapper, - MamlHelpers, - Plane, - plot_optimal_policy, - plot_results, -) +from maml_rl.envs.helpers import (Awake_Benchmarking_Wrapper, MamlHelpers, + Plane, plot_optimal_policy, plot_results) # Standard environment for the AWAKE environment, # adjusted, so it can be used for the MAML therefore containing diff --git a/meta-rl/maml_rl/metalearners/maml_trpo.py b/meta-rl/maml_rl/metalearners/maml_trpo.py index 4eb208d..49cd463 100755 --- a/meta-rl/maml_rl/metalearners/maml_trpo.py +++ b/meta-rl/maml_rl/metalearners/maml_trpo.py @@ -5,12 +5,8 @@ from maml_rl.metalearners.base import GradientBasedMetaLearner from maml_rl.utils.optimization import conjugate_gradient from maml_rl.utils.reinforcement_learning import reinforce_loss -from maml_rl.utils.torch_utils import ( - detach_distribution, - to_numpy, - vector_to_parameters, - weighted_mean, -) +from maml_rl.utils.torch_utils import (detach_distribution, to_numpy, + vector_to_parameters, weighted_mean) class MAMLTRPO(GradientBasedMetaLearner): diff --git a/meta-rl/ppo.py b/meta-rl/ppo.py index 2481fed..188d19a 100755 --- a/meta-rl/ppo.py +++ b/meta-rl/ppo.py @@ -3,9 +3,10 @@ import numpy as np import torch +from stable_baselines3 import PPO + from maml_rl.envs.awake_steering_simulated import AwakeSteering as awake_env from policy_test import verify_external_policy_on_specific_env -from stable_baselines3 import PPO def main(args): diff --git a/meta-rl/read_out_train.py b/meta-rl/read_out_train.py index bb36220..edfbf56 100755 --- a/meta-rl/read_out_train.py +++ b/meta-rl/read_out_train.py @@ -9,9 +9,10 @@ import matplotlib.pyplot as plt import numpy as np -from maml_rl.utils.reinforcement_learning import get_returns from sympy import root +from maml_rl.utils.reinforcement_learning import get_returns + # from maml_rl.utils.torch_utils import to_numpy diff --git a/meta-rl/test.py b/meta-rl/test.py index b7888cc..af8a3db 100755 --- a/meta-rl/test.py +++ b/meta-rl/test.py @@ -14,7 +14,8 @@ from maml_rl.envs.awake_steering_simulated import AwakeSteering as awake_env from maml_rl.samplers import MultiTaskSampler from maml_rl.utils.helpers import get_input_size, get_policy_for_env -from maml_rl.utils.reinforcement_learning import get_episode_lengths, get_returns +from maml_rl.utils.reinforcement_learning import (get_episode_lengths, + get_returns) from policy_test import _layout_verficication_plot, verify