Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions neurons/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ async def run_step(self):

raw_scores_this_epoch = {}
block_per_uid = {}
metadata_per_uid = {} # Store metadata for each UID
for uid in uids_to_eval:
bt.logging.info(f"Evaluating UID: {uid}")
bt.logging.info(
Expand All @@ -255,6 +256,7 @@ async def run_step(self):
metadata = retrieve_model_metadata(
self.subtensor, self.config.netuid, self.metagraph.hotkeys[uid]
)
metadata_per_uid[uid] = metadata # Store metadata for this specific UID

if self.should_set_weights():
bt.logging.info(
Expand Down Expand Up @@ -399,6 +401,12 @@ async def run_step(self):
normalized_scores_this_epoch = {}
for uid in uids_to_eval:
current_raw_score = raw_scores_this_epoch.get(uid)

# Skip UIDs that were not evaluated (no metadata)
if uid not in metadata_per_uid:
bt.logging.debug(f"UID {uid} was not evaluated, skipping normalization")
continue

if current_raw_score is not None:
bt.logging.debug(
f"Computing normalized score for UID {uid} with raw score {current_raw_score}"
Expand All @@ -409,14 +417,17 @@ async def run_step(self):
)
normalized_score = constants.DEFAULT_SCORE
else:
# Use the correct metadata for this UID
uid_metadata = metadata_per_uid[uid]

normalized_score = compute_score(
current_raw_score,
competition.bench,
competition.minb,
competition.maxb,
competition.pow,
competition.bheight,
metadata.id.competition_id,
uid_metadata.id.competition_id, # Use correct metadata
competition.id,
)
normalized_scores_this_epoch[uid] = normalized_score
Expand Down Expand Up @@ -482,4 +493,4 @@ async def run(self):


if __name__ == "__main__":
asyncio.run(Validator().run())
asyncio.run(Validator().run())