Skip to content

Commit 2402f74

Browse files
Add files via upload
1 parent ab6e2a6 commit 2402f74

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

10_Pong-v0_A3C/Pong-v0_A3C.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import os
55
#os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
6-
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
6+
os.environ['CUDA_VISIBLE_DEVICES'] = '1'
77
import random
88
import gym
99
import pylab
@@ -255,7 +255,11 @@ def train(self, n_threads):
255255
for t in threads:
256256
time.sleep(2)
257257
t.start()
258-
258+
259+
for t in threads:
260+
time.sleep(10)
261+
t.join()
262+
259263
def train_threading(self, agent, env, thread):
260264
global graph
261265
with graph.as_default():
@@ -318,5 +322,5 @@ def test(self, Actor_name, Critic_name):
318322
env_name = 'Pong-v0'
319323
agent = A3CAgent(env_name)
320324
#agent.run() # use as A2C
321-
agent.train(n_threads=5) # use as A3C
322-
#agent.test('Models/Pong-v0_A3C_2.5e-05_Actor.h5', '')
325+
#agent.train(n_threads=5) # use as A3C
326+
agent.test('Models/Pong-v0_A3C_2.5e-05_Actor.h5', '')

0 commit comments

Comments
 (0)