Skip to content

Commit

Permalink
fix: add missing attr
Browse files Browse the repository at this point in the history
  • Loading branch information
jarvis8x7b committed Jan 5, 2024
1 parent 0c10128 commit ce5f9ea
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions template/base/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def __init__(self, config=None):
self.is_running: bool = False
self.thread: threading.Thread = None
self.lock = asyncio.Lock()
self.moving_averaged_scores = None

def serve_axon(self):
"""Serve axon to enable external connections."""
Expand Down Expand Up @@ -213,6 +214,8 @@ def set_weights(self):
bt.logging.warning(
f"Scores contain NaN values. This may be due to a lack of responses from miners, or a bug in your reward functions."
)
if self.moving_averaged_scores is None:
self.moving_averaged_scores = self.scores.clone().detach()

# Calculate the average reward for each uid across non-zero values.
# Replace any NaN values with 0.
Expand Down

0 comments on commit ce5f9ea

Please sign in to comment.