From b16f89d57054fe06878645768ecfcc8685ca2df5 Mon Sep 17 00:00:00 2001 From: hscott Date: Thu, 5 Dec 2024 12:46:48 -0500 Subject: [PATCH] unnecessary asyncio lock blocks runtime --- precog/validators/weight_setter.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/precog/validators/weight_setter.py b/precog/validators/weight_setter.py index 4986b03..1199827 100755 --- a/precog/validators/weight_setter.py +++ b/precog/validators/weight_setter.py @@ -165,12 +165,11 @@ async def scheduled_prediction_request(self): 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. - async with self.lock: - for i, value in zip(self.available_uids, rewards): - self.moving_average_scores[i] = (1 - self.config.alpha) * self.moving_average_scores[ - i - ] + self.config.alpha * value - self.scores = list(self.moving_average_scores.values()) + for i, value in zip(self.available_uids, rewards): + self.moving_average_scores[i] = (1 - self.config.alpha) * self.moving_average_scores[ + i + ] + self.config.alpha * value + self.scores = list(self.moving_average_scores.values()) if self.config.wandb_on: log_wandb(responses, rewards, self.available_uids) else: