From 058128f6d5da0420066aab5ed605c5e5a2517d97 Mon Sep 17 00:00:00 2001 From: Steffen Cruz <steffenjcruz@gmail.com> Date: Thu, 29 Feb 2024 11:08:53 -0600 Subject: [PATCH 1/4] Do not enable miners to set weights --- prompting/base/neuron.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/prompting/base/neuron.py b/prompting/base/neuron.py index 4ca8e92b..151f70fe 100644 --- a/prompting/base/neuron.py +++ b/prompting/base/neuron.py @@ -154,6 +154,9 @@ def should_set_weights(self) -> bool: if self.config.neuron.disable_set_weights: return False + if not self.metagraph.validator_permit[self.uid]: + return False + # Define appropriate logic for when set weights. return ( self.block - self.metagraph.last_update[self.uid] From f3a2280287821d5cf53710eff77d128dbb719b0c Mon Sep 17 00:00:00 2001 From: Steffen Cruz <steffenjcruz@gmail.com> Date: Thu, 29 Feb 2024 11:09:07 -0600 Subject: [PATCH 2/4] Remove set weights function for miners --- prompting/base/miner.py | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/prompting/base/miner.py b/prompting/base/miner.py index fbc9d6c5..4612283a 100644 --- a/prompting/base/miner.py +++ b/prompting/base/miner.py @@ -183,38 +183,6 @@ def __exit__(self, exc_type, exc_value, traceback): """ self.stop_run_thread() - def set_weights(self): - """ - Self-assigns a weight of 1 to the current miner (identified by its UID) and - a weight of 0 to all other peers in the network. The weights determine the trust level the miner assigns to other nodes on the network. - - Raises: - Exception: If there's an error while setting weights, the exception is logged for diagnosis. - """ - try: - # --- query the chain for the most current number of peers on the network - chain_weights = torch.zeros( - self.subtensor.subnetwork_n(netuid=self.metagraph.netuid) - ) - chain_weights[self.uid] = 1 - - # --- Set weights. - self.subtensor.set_weights( - wallet=self.wallet, - netuid=self.metagraph.netuid, - uids=torch.arange(0, len(chain_weights)), - weights=chain_weights.to("cpu"), - wait_for_inclusion=False, - version_key=self.spec_version, - ) - - except Exception as e: - bt.logging.error( - f"Failed to set weights on chain with exception: { e }" - ) - - bt.logging.info(f"Set weights: {chain_weights}") - def resync_metagraph(self): """Resyncs the metagraph and updates the hotkeys and moving averages based on the new metagraph.""" bt.logging.info("resync_metagraph()") From ed301b9e8c07da9e2f25b090fe6954ccb99924ff Mon Sep 17 00:00:00 2001 From: p-ferreira <38992619+p-ferreira@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:13:10 -0500 Subject: [PATCH 3/4] fix log status --- neurons/miner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neurons/miner.py b/neurons/miner.py index c0d25730..b49f974e 100644 --- a/neurons/miner.py +++ b/neurons/miner.py @@ -175,7 +175,7 @@ def log_event(self, timing: float, prompt: str, completion: str, system_prompt: def log_status(self): m = self.metagraph - bt.logging.info(f"Miner running:: network: {self.subtensor.network} | block: {self.block} | step: {self.step} | uid: {self.uid} | last updated: {self.block-m.last_update[self.uid]} | trust: {m.trust[self.uid]:.3f} | emission {m.emission[self.uid]:.3f}") + bt.logging.info(f"Miner running:: network: {self.subtensor.network} | step: {self.step} | uid: {self.uid} | trust: {m.trust[self.uid]:.3f} | emission {m.emission[self.uid]:.3f}") # This is the main function, which runs the miner. if __name__ == "__main__": From 7c80b2a0dcd1664831576744892d62f9d72859df Mon Sep 17 00:00:00 2001 From: p-ferreira <38992619+p-ferreira@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:26:52 -0500 Subject: [PATCH 4/4] update versioning --- prompting/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prompting/__init__.py b/prompting/__init__.py index f7cfdd47..e3b13d0f 100644 --- a/prompting/__init__.py +++ b/prompting/__init__.py @@ -16,7 +16,7 @@ # DEALINGS IN THE SOFTWARE. # Define the version of the template module. -__version__ = "1.1.1" +__version__ = "1.1.2" version_split = __version__.split(".") __spec_version__ = ( (10000 * int(version_split[0]))