Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions neurons/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ class Validator(BaseValidatorNeuron):
def __init__(self, config=None):
super(Validator, self).__init__(config=config)

bt.logging.info("load_state()")
self.load_state()

# TODO(developer): Anything specific to your use case you can do here

async def forward(self):
Expand Down
16 changes: 13 additions & 3 deletions template/base/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def __init__(self, config=None):
bt.logging.info("Building validation weights.")
self.scores = np.zeros(self.metagraph.n, dtype=np.float32)

# Load the state of the validator from file.
self.load_state()

# Init sync with the network. Updates the metagraph.
self.sync()

Expand Down Expand Up @@ -382,6 +385,13 @@ def load_state(self):

# Load the state of the validator from file.
state = np.load(self.config.neuron.full_path + "/state.npz")
self.step = state["step"]
self.scores = state["scores"]
self.hotkeys = state["hotkeys"]
if "step" in state:
self.step = state["step"]
self.scores = state["scores"]
self.hotkeys = state["hotkeys"]
else:
# Set up initial scoring weights for validation
bt.logging.info("Building validation weights.")
self.step = 0
self.scores = np.zeros(self.metagraph.n, dtype=np.float32)
self.hotkeys = copy.deepcopy(self.metagraph.hotkeys)