From 43a1b66e6de4300139e48c9c1fa58382223e034b Mon Sep 17 00:00:00 2001 From: wassname Date: Mon, 25 Jun 2018 05:39:35 +0800 Subject: [PATCH] tidy --- agents/ppo2_agent.py | 26 +++++++++++++++++++------- agents/sonic_util.py | 2 -- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/agents/ppo2_agent.py b/agents/ppo2_agent.py index e807981..bc8a889 100644 --- a/agents/ppo2_agent.py +++ b/agents/ppo2_agent.py @@ -105,13 +105,25 @@ def train(env_id, num_timesteps, policy, working_dir, config): # Enter learning policy = {'cnn': CnnPolicy, 'lstmdense': LstmPolicyDense, 'lstm': LstmPolicy}[policy] - ppo2_rudder.learn(policy=policy, env=env, nsteps=1024, nminibatches=4, lam=0.95, gamma=0.99, noptepochs=3, - log_interval=1, ent_coef=bl_config['ent_coef'], lr=lambda f: f * 2.5e-4 * bl_config['lr_coef'], - cliprange=lambda f: f * 0.1, total_timesteps=int(num_timesteps * 1.1), tf_session=tf_session, - working_dir=working_dir, config=config, - plotting=dict(save_subplots=save_subplots, save_movie=save_movie, - save_subplots_line_plots=save_subplots_line_plots), - rnd_gen=rnd_gen) + ppo2_rudder.learn( + policy=policy, + env=env, + nsteps=1024, + nminibatches=2, + lam=0.95, + gamma=0.99, + noptepochs=3, + log_interval=1, + ent_coef=bl_config['ent_coef'], + lr=lambda f: f * 2.5e-4 * bl_config['lr_coef'], + cliprange=lambda f: f * 0.1, + total_timesteps=int(num_timesteps * 1.1), tf_session=tf_session, + working_dir=working_dir, + config=config, + plotting=dict(save_subplots=save_subplots, save_movie=save_movie, + save_subplots_line_plots=save_subplots_line_plots), + rnd_gen=rnd_gen + ) if __name__ == '__main__': diff --git a/agents/sonic_util.py b/agents/sonic_util.py index 0106cf2..47a9763 100644 --- a/agents/sonic_util.py +++ b/agents/sonic_util.py @@ -30,8 +30,6 @@ def make_env(stack=True, scale_rew=True): if scale_rew: env = RewardScaler(env) env = WarpFrame(env) - # if stack: - # env = FrameStack(env, 4) return env class SonicDiscretizer(gym.ActionWrapper):