minor fixed on self play

This commit is contained in:
rtz19970824 2017-12-11 15:56:16 +08:00
parent 715f7be6a8
commit e88d651400
2 changed files with 10 additions and 7 deletions

View File

@ -192,13 +192,16 @@ class Network(object):
# checkpoint_path = "/home/tongzheng/tianshou/AlphaGo/checkpoints/" # checkpoint_path = "/home/tongzheng/tianshou/AlphaGo/checkpoints/"
# sess = multi_gpu.create_session() # sess = multi_gpu.create_session()
# sess.run(tf.global_variables_initializer()) # sess.run(tf.global_variables_initializer())
ckpt_file = tf.train.latest_checkpoint(checkpoint_path) if checkpoint_path is None:
if ckpt_file is not None: self.sess.run(tf.global_variables_initializer())
# print('Restoring model from {}...'.format(ckpt_file))
self.saver.restore(self.sess, ckpt_file)
# print('Successfully loaded')
else: else:
raise ValueError("No model loaded") ckpt_file = tf.train.latest_checkpoint(checkpoint_path)
if ckpt_file is not None:
# print('Restoring model from {}...'.format(ckpt_file))
self.saver.restore(self.sess, ckpt_file)
# print('Successfully loaded')
else:
raise ValueError("No model loaded")
# prior, value = sess.run([tf.nn.softmax(p), v], feed_dict={x: state, is_training: False}) # prior, value = sess.run([tf.nn.softmax(p), v], feed_dict={x: state, is_training: False})
# return prior, value # return prior, value
return self.sess return self.sess

View File

@ -14,7 +14,7 @@ args = parser.parse_args()
if not os.path.exists(args.result_path): if not os.path.exists(args.result_path):
os.makedirs(args.result_path) os.makedirs(args.result_path)
game = Game() game = Game(checkpoint_path="./checkpoints/")
engine = GTPEngine(game_obj=game) engine = GTPEngine(game_obj=game)
history = deque(maxlen=8) history = deque(maxlen=8)
for i in range(8): for i in range(8):