Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonlessons authored Mar 29, 2020
1 parent ab6e2a6 commit 2402f74
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions 10_Pong-v0_A3C/Pong-v0_A3C.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import os
#os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
os.environ['CUDA_VISIBLE_DEVICES'] = '1'
import random
import gym
import pylab
Expand Down Expand Up @@ -255,7 +255,11 @@ def train(self, n_threads):
for t in threads:
time.sleep(2)
t.start()


for t in threads:
time.sleep(10)
t.join()

def train_threading(self, agent, env, thread):
global graph
with graph.as_default():
Expand Down Expand Up @@ -318,5 +322,5 @@ def test(self, Actor_name, Critic_name):
env_name = 'Pong-v0'
agent = A3CAgent(env_name)
#agent.run() # use as A2C
agent.train(n_threads=5) # use as A3C
#agent.test('Models/Pong-v0_A3C_2.5e-05_Actor.h5', '')
#agent.train(n_threads=5) # use as A3C
agent.test('Models/Pong-v0_A3C_2.5e-05_Actor.h5', '')

0 comments on commit 2402f74

Please sign in to comment.