Skip to content
This repository was archived by the owner on Jul 10, 2026. It is now read-only.

Unnecessary code in neurons/validator.py #139

Description

@pycorn0729

- neurons/validator.py

42    def __init__(self, config=None):
43        super(Validator, self).__init__(config=config)
44
45        bt.logging.info("load_state()")
46       self.load_state()

- template/base/validator.py

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

- template/base/validator.py

def save_state(self):
    """Saves the state of the validator to a file."""
    bt.logging.info("Saving validator state.")

    # Save the state of the validator to file.
    np.savez(
        self.config.neuron.full_path + "/state.npz",
        step=self.step,
        scores=self.scores,
        hotkeys=self.hotkeys,
    )

def load_state(self):
    """Loads the state of the validator from a file."""
    bt.logging.info("Loading validator state.")

    # 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"]

load_state() in neurons/validator.py is not needed.

the state is cleared when sync() is called in template/base/validator.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions