Skip to content

Commit 0dcb3af

Browse files
committed
chore: remove hard coded number
1 parent ea011f7 commit 0dcb3af

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

neurons/validators/score_manager.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99

1010
from webgenie.base.neuron import BaseNeuron
1111
from webgenie.challenges.challenge import Challenge
12-
from webgenie.constants import CONSIDERING_SESSION_COUNTS, __STATE_VERSION__, WORK_DIR
12+
from webgenie.constants import (
13+
CONSIDERING_SESSION_COUNTS,
14+
__STATE_VERSION__,
15+
WORK_DIR,
16+
MAX_UNANSWERED_TASKS,
17+
)
1318
from webgenie.helpers.weights import save_file_to_wandb
1419

1520
class ScoreManager:
@@ -169,7 +174,7 @@ def get_winner(self, total_scores: np.ndarray, solved_tasks: np.ndarray, number_
169174
if self.is_blacklisted(uid):
170175
continue
171176

172-
if solved_tasks[uid] >= max(1, number_of_tasks - 10):
177+
if solved_tasks[uid] >= max(1, number_of_tasks - MAX_UNANSWERED_TASKS):
173178
avg_scores[uid] = total_scores[uid] / solved_tasks[uid]
174179
else:
175180
avg_scores[uid] = 0
@@ -222,7 +227,7 @@ def print_session_result(self, session_upto: int, console: Console):
222227

223228
avg_scores = np.zeros(self.neuron.metagraph.n, dtype=np.float32)
224229
for uid in range(self.neuron.metagraph.n):
225-
if solved_tasks[uid] >= max(1, number_of_tasks - 10):
230+
if solved_tasks[uid] >= max(1, number_of_tasks - MAX_UNANSWERED_TASKS):
226231
avg_scores[uid] = scores[uid] / solved_tasks[uid]
227232
else:
228233
avg_scores[uid] = 0

webgenie/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989

9090
MAX_NUMBER_OF_TASKS_PER_SESSION = 18 # max number of tasks per session
9191

92+
MAX_UNANSWERED_TASKS = 10 # max unanswered tasks
93+
9294
NUMBER_OF_CONCURRENT_WORKERS = max(
9395
1,
9496
min(

0 commit comments

Comments
 (0)