Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary code in neurons/validator.py #139

Open
pycorn0729 opened this issue Dec 19, 2024 · 0 comments
Open

Unnecessary code in neurons/validator.py #139

pycorn0729 opened this issue Dec 19, 2024 · 0 comments

Comments

@pycorn0729
Copy link

- 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant