|
8 | 8 | from typing import List
|
9 | 9 |
|
10 | 10 | from webgenie.base.neuron import BaseNeuron
|
11 |
| -from webgenie.challenges.challenge import Challenge |
12 |
| -from webgenie.constants import ( |
13 |
| - CONSIDERING_SESSION_COUNTS, |
14 |
| - __STATE_VERSION__, |
15 |
| - WORK_DIR, |
16 |
| - MAX_UNANSWERED_TASKS, |
17 |
| -) |
| 11 | + |
| 12 | +from webgenie.challenges.challenge import Challenge, RESERVED_WEIGHTS |
| 13 | +from webgenie.constants import CONSIDERING_SESSION_COUNTS, __STATE_VERSION__, WORK_DIR |
18 | 14 | from webgenie.helpers.weights import save_file_to_wandb
|
19 | 15 |
|
20 | 16 | class ScoreManager:
|
@@ -183,30 +179,37 @@ def get_winner(self, total_scores: np.ndarray, solved_tasks: np.ndarray, number_
|
183 | 179 |
|
184 | 180 | def get_scores(self, session_upto: int):
|
185 | 181 | scores = np.zeros(self.neuron.metagraph.n, dtype=np.float32)
|
186 |
| - tiny_weight = 1 / 128 |
187 |
| - big_weight = 1.0 |
188 | 182 | for session_number in self.session_results:
|
189 | 183 | if (session_number <= session_upto - CONSIDERING_SESSION_COUNTS or
|
190 | 184 | session_number > session_upto):
|
191 | 185 | continue
|
192 |
| - |
193 |
| - winner = self.get_winner( |
194 |
| - self.session_results[session_number]["scores"], |
195 |
| - self.session_results[session_number]["solved_tasks"], |
196 |
| - self.session_results[session_number]["number_of_tasks"], |
197 |
| - ) |
198 |
| - if winner == -1: |
199 |
| - continue |
200 |
| - if session_number == session_upto: |
201 |
| - scores[winner] += big_weight |
202 |
| - else: |
203 |
| - scores[winner] += tiny_weight |
204 |
| - |
205 |
| - for uid in range(self.neuron.metagraph.n): |
206 |
| - if self.is_blacklisted(uid): |
207 |
| - scores[uid] = 0 |
208 |
| - |
| 186 | + |
| 187 | + try: |
| 188 | + winner = self.session_results[session_number]["winner"] |
| 189 | + competition_type = self.session_results[session_number]["competition_type"] |
| 190 | + if winner == -1: |
| 191 | + continue |
| 192 | + scores[winner] += RESERVED_WEIGHTS[competition_type] |
| 193 | + except Exception as e: |
| 194 | + bt.logging.warning(f"Error getting scores: {e}") |
| 195 | + |
209 | 196 | return scores
|
| 197 | + # scores = np.zeros(self.neuron.metagraph.n, dtype=np.float32) |
| 198 | + # tiny_weight = 1 / 128 |
| 199 | + # big_weight = 1.0 |
| 200 | + # for session_number in self.session_results: |
| 201 | + # if (session_number <= session_upto - CONSIDERING_SESSION_COUNTS or |
| 202 | + # session_number > session_upto): |
| 203 | + # continue |
| 204 | + |
| 205 | + # winner = self.session_results[session_number]["winner"] |
| 206 | + # if winner == -1: |
| 207 | + # continue |
| 208 | + # if session_number == session_upto: |
| 209 | + # scores[winner] += big_weight |
| 210 | + # else: |
| 211 | + # scores[winner] += tiny_weight |
| 212 | + # return scores |
210 | 213 |
|
211 | 214 | # if session_upto in self.session_results:
|
212 | 215 | # scores = self.session_results[session_upto]["scores"]
|
|
0 commit comments