Skip to content

Commit

Permalink
Working training - 00003 learning rate and frame skip
Browse files Browse the repository at this point in the history
  • Loading branch information
ClarityCoders committed Sep 17, 2022
1 parent 0ae3704 commit 37b9a33
Show file tree
Hide file tree
Showing 14 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import gym
from RandomAgent import TimeLimitWrapper
from stable_baselines3 import PPO
from stable_baselines3.common.atari_wrappers import MaxAndSkipEnv


model = PPO.load("tmp/best_model.zip")
Expand All @@ -11,7 +12,8 @@ def main():
#env = retro.make(game='MegaMan2-Nes')
env = retro.make(game='SuperMarioBros-Nes')
env = TimeLimitWrapper(env)

env = MaxAndSkipEnv(env, 4)

obs = env.reset()
done = False

Expand Down
6 changes: 3 additions & 3 deletions Train.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ def _init():
# You can choose between `DummyVecEnv` (usually faster) and `SubprocVecEnv`
# env = make_vec_env(env_id, n_envs=num_cpu, seed=0, vec_env_cls=SubprocVecEnv)

#model = PPO('CnnPolicy', env, verbose=1, tensorboard_log="./board/")
model = PPO.load("tmp/best_model", env=env)
model = PPO('CnnPolicy', env, verbose=1, tensorboard_log="./board/", learning_rate=0.00003)
#model = PPO.load("tmp/best_model", env=env)
print("------------- Start Learning -------------")
callback = SaveOnBestTrainingRewardCallback(check_freq=1000, log_dir=log_dir)
model.learn(total_timesteps=5000000, callback=callback)
model.learn(total_timesteps=5000000, callback=callback, tb_log_name="PPO-00003")
model.save(env_id)
print("------------- Done Learning -------------")
env = retro.make(game=env_id)
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 37b9a33

Please sign in to comment.