From 38c53a8fb454b7038f4c15820feaf6f65f8a0f56 Mon Sep 17 00:00:00 2001 From: pcarlson-foundry-digital Date: Thu, 9 Jan 2025 15:34:53 -0500 Subject: [PATCH] update weight_setter.py so rewards is processed inside a try block --- precog/validators/weight_setter.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/precog/validators/weight_setter.py b/precog/validators/weight_setter.py index bbea858..0eff51e 100755 --- a/precog/validators/weight_setter.py +++ b/precog/validators/weight_setter.py @@ -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)