From 2402f7480b4a4e0ea0b05067c84ef463ae711f90 Mon Sep 17 00:00:00 2001 From: pythonlessons <43852392+pythonlessons@users.noreply.github.com> Date: Sun, 29 Mar 2020 14:57:15 +0300 Subject: [PATCH] Add files via upload --- 10_Pong-v0_A3C/Pong-v0_A3C.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/10_Pong-v0_A3C/Pong-v0_A3C.py b/10_Pong-v0_A3C/Pong-v0_A3C.py index b21eea7..2add1be 100644 --- a/10_Pong-v0_A3C/Pong-v0_A3C.py +++ b/10_Pong-v0_A3C/Pong-v0_A3C.py @@ -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 @@ -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(): @@ -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', '')