@@ -124,13 +124,16 @@ def print_weights(self, raw_weights: np.ndarray):
124
124
console .print (weights_table )
125
125
126
126
def set_weights (self ):
127
- # with self.lock:
128
- # current_session = self.session
129
- # last_set_weights_session = self.score_manager.last_set_weights_session
130
- # if last_set_weights_session == current_session - 1:
131
- # return
132
- current_session = self . session
127
+ with self .lock :
128
+ current_session = self .session
129
+ last_set_weights_session = self .score_manager .last_set_weights_session
130
+ if last_set_weights_session == current_session - 1 :
131
+ return
132
+
133
133
scores = self .score_manager .get_scores (current_session - 1 )
134
+ if np .all (scores == 0 ):
135
+ bt .logging .info (f"All scores are 0, skipping set_weights" )
136
+ return
134
137
# Calculate the average reward for each uid across non-zero values.
135
138
# Replace any NaN values with 0.
136
139
# Compute the norm of the scores
@@ -289,12 +292,12 @@ def query_miners_loop(self):
289
292
# )
290
293
# )
291
294
FORWARD_TIMEOUT = 60 * 60 * 2 # 2 hours
292
- # self.query_miners_event_loop.run_until_complete(
293
- # asyncio.wait_for(
294
- # self.genie_validator.forward(),
295
- # timeout=FORWARD_TIMEOUT
296
- # )
297
- # )
295
+ self .query_miners_event_loop .run_until_complete (
296
+ asyncio .wait_for (
297
+ self .genie_validator .forward (),
298
+ timeout = FORWARD_TIMEOUT
299
+ )
300
+ )
298
301
except Exception as e :
299
302
bt .logging .error (f"Error during query miners loop: { str (e )} " )
300
303
if self .should_exit :
0 commit comments