Explorar el Código

check for None

justheuristic hace 3 años
padre
commit
1d408e8e9c
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      hivemind/averaging/averager.py

+ 3 - 2
hivemind/averaging/averager.py

@@ -455,9 +455,10 @@ class DecentralizedAverager(mp.Process, ServicerBase):
 
                     group_info = await matchmaking_task
 
+                    if group_info is None:
+                        raise AllreduceException("Averaging step failed: could not find a group")
+
                     with self._register_allreduce_group(group_info):
-                        if group_info is None:
-                            raise AllreduceException("Averaging step failed: could not find a group")
 
                         step.stage = AveragingStage.RUNNING_ALLREDUCE