From 6509a51b967a989b1548375016488aa1c32148f1 Mon Sep 17 00:00:00 2001 From: Srizzle <7622839+Srizzle@users.noreply.github.com> Date: Wed, 21 Nov 2018 12:00:34 -0800 Subject: [PATCH] fixed bug (#185) * fixed bug it's wrong to do the else statement, because no other nodes would start. * changed the fix slightly --- baselines/ppo2/model.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/baselines/ppo2/model.py b/baselines/ppo2/model.py index 2ce6344..2326b46 100644 --- a/baselines/ppo2/model.py +++ b/baselines/ppo2/model.py @@ -122,10 +122,9 @@ class Model(object): self.save = functools.partial(save_variables, sess=sess) self.load = functools.partial(load_variables, sess=sess) - if MPI is None or MPI.COMM_WORLD.Get_rank() == 0: - initialize() - else: - global_variables = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope="") + initialize() + global_variables = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope="") + if MPI is not None: sync_from_root(sess, global_variables) #pylint: disable=E1101 def train(self, lr, cliprange, obs, returns, masks, actions, values, neglogpacs, states=None):