소스 검색

check for None

justheuristic 3 년 전
부모
커밋
1d408e8e9c
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  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