Skip to content

Commit

Permalink
update weight_setter.py so rewards is processed inside a try block
Browse files Browse the repository at this point in the history
  • Loading branch information
peterc-yuma committed Jan 9, 2025
1 parent 4923a05 commit 38c53a8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions precog/validators/weight_setter.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,16 @@ async def scheduled_prediction_request(self):
responses, self.timestamp = self.query_miners()
try:
rewards = calc_rewards(self, responses=responses)
# Adjust the scores based on responses from miners and update moving average.
for i, value in zip(self.available_uids, rewards):
self.moving_average_scores[i] = (
1 - self.config.neuron.moving_average_alpha
) * self.moving_average_scores[i] + self.config.neuron.moving_average_alpha * value
self.scores = list(self.moving_average_scores.values())
if not self.config.wandb.off:
log_wandb(responses, rewards, self.available_uids)
except Exception as e:
bt.logging.error(f"Failed to calculate rewards with error: {e}")
# Adjust the scores based on responses from miners and update moving average.
for i, value in zip(self.available_uids, rewards):
self.moving_average_scores[i] = (
1 - self.config.neuron.moving_average_alpha
) * self.moving_average_scores[i] + self.config.neuron.moving_average_alpha * value
self.scores = list(self.moving_average_scores.values())
if not self.config.wandb.off:
log_wandb(responses, rewards, self.available_uids)
else:
print_info(self)

Expand Down

0 comments on commit 38c53a8

Please sign in to comment.