Reseed for each worker

This commit is contained in:
Shangtong Zhang
2017-12-25 09:52:38 -07:00
parent 964734755f
commit 0b075a353b
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -13,8 +13,11 @@ from async_worker import *
import pickle
import os
import time
import sys
def train(id, config, learning_network, extra):
np.random.seed()
torch.manual_seed(np.random.randint(sys.maxsize))
worker = config.worker(config, learning_network, extra)
episode = 0
rewards = []
@@ -27,6 +30,8 @@ def train(id, config, learning_network, extra):
episode += 1
def evaluate(config, task, learning_network, extra):
np.random.seed()
torch.manual_seed(np.random.randint(sys.maxsize))
test_rewards = []
test_points = []
test_wall_times = []
+2 -2
View File
@@ -283,7 +283,7 @@ if __name__ == '__main__':
# dqn_cart_pole()
# async_cart_pole()
# a3c_cart_pole()
a3c_cart_pole()
# a3c_continuous()
# p3o_continuous()
# d3pg_continuous()
@@ -291,7 +291,7 @@ if __name__ == '__main__':
# dqn_fruit()
# hrdqn_fruit()
dqn_pixel_atari('PongNoFrameskip-v4')
# dqn_pixel_atari('PongNoFrameskip-v4')
# async_pixel_atari('PongNoFrameskip-v4')
# a3c_pixel_atari('PongNoFrameskip-v4')