Ver código fonte

ignore_stale_updates

justheuristic 3 anos atrás
pai
commit
ad82b1ca20
1 arquivos alterados com 2 adições e 1 exclusões
  1. 2 1
      hivemind/optim/collaborative.py

+ 2 - 1
hivemind/optim/collaborative.py

@@ -450,8 +450,9 @@ class CollaborativeOptimizer(DecentralizedOptimizerBase):
         total_samples_accumulated = estimated_current_samples = total_samples_per_second = 0
 
         for state in valid_peer_states:
-            if current_time - state.time < self.staleness_timeout:
+            if current_time - state.time > self.staleness_timeout:
                 logger.debug(f"Peer record {state} was discarded because it is too old: {current_time - state.time} s.")
+                continue
             total_samples_per_second += state.samples_per_second
             if state.step >= global_optimizer_step - self.step_tolerance:
                 total_samples_accumulated += state.samples_accumulated