diff --git a/cybertensor/commands/network.py b/cybertensor/commands/network.py index 2bd2120..ddca43b 100644 --- a/cybertensor/commands/network.py +++ b/cybertensor/commands/network.py @@ -669,13 +669,6 @@ def add_args(parser: argparse.ArgumentParser): parser.add_argument( "--netuid", dest="netuid", type=int, required=False, default=False ) - parser.add_argument( - "--no_prompt", - dest="no_prompt", - action="store_true", - help="""Set true to avoid prompting the user.""", - default=False, - ) Wallet.add_args(parser) cybertensor.cwtensor.add_args(parser) @@ -731,7 +724,7 @@ def run(cli: "cybertensor.cli") -> None: r"""Get weights for root network.""" try: cwtensor = cybertensor.cwtensor(config=cli.config, log_verbose=False) - SubnetSetWeightsCommand._run(cli, cwtensor) + SubnetGetWeightsCommand._run(cli, cwtensor) finally: if "cwtensor" in locals(): cwtensor.close() @@ -811,13 +804,6 @@ def add_args(parser: argparse.ArgumentParser): parser.add_argument( "--netuid", dest="netuid", type=int, required=False, default=False ) - parser.add_argument( - "--no_prompt", - dest="no_prompt", - action="store_true", - help="""Set true to avoid prompting the user.""", - default=False, - ) Wallet.add_args(parser) cybertensor.cwtensor.add_args(parser) diff --git a/cybertensor/commands/stake.py b/cybertensor/commands/stake.py index c81ee51..176c87b 100644 --- a/cybertensor/commands/stake.py +++ b/cybertensor/commands/stake.py @@ -403,10 +403,10 @@ def get_stake_accounts( cold_balance = cwtensor.get_balance(wallet.coldkeypub.address) # Populate the stake accounts with local hotkeys data. - wallet_stake_accounts.update(get_stakes_from_hotkeys(cwtensor, wallet)) + wallet_stake_accounts.update(get_stakes_from_hotkeys(cwtensor=cwtensor, wallet=wallet)) # Populate the stake accounts with delegations data. - wallet_stake_accounts.update(get_stakes_from_delegates(cwtensor, wallet)) + wallet_stake_accounts.update(get_stakes_from_delegates(cwtensor=cwtensor, wallet=wallet)) return { "name": wallet.name, diff --git a/cybertensor/commands/wallets.py b/cybertensor/commands/wallets.py index d65be67..4c8cc30 100644 --- a/cybertensor/commands/wallets.py +++ b/cybertensor/commands/wallets.py @@ -723,13 +723,6 @@ def add_args(parser: argparse.ArgumentParser): help="""Updates the wallet security using NaCL instead of anvisible vault.""", ) update_wallet_parser.add_argument("--all", action="store_true") - update_wallet_parser.add_argument( - "--no_prompt", - dest="no_prompt", - action="store_true", - help="""Set true to avoid prompting the user.""", - default=False, - ) Wallet.add_args(update_wallet_parser) cybertensor.cwtensor.add_args(update_wallet_parser) diff --git a/cybertensor/cwtensor.py b/cybertensor/cwtensor.py index 86fe5e6..b0c0409 100644 --- a/cybertensor/cwtensor.py +++ b/cybertensor/cwtensor.py @@ -623,29 +623,29 @@ def set_weights( This function is crucial in shaping the network's collective intelligence, where each neuron's learning and contribution are influenced by the weights it sets towards others【81†source】. """ - uid = self.get_uid_for_hotkey_on_subnet(wallet.hotkey.address, netuid) - retries = 0 + # uid = self.get_uid_for_hotkey_on_subnet(wallet.hotkey.address, netuid) + # retries = 0 success = False message = "No attempt made. Perhaps it is too soon to set weights!" - while ( - self.blocks_since_last_update(netuid, uid) > self.weights_rate_limit(netuid) # type: ignore - and retries < max_retries - ): - try: - success, message = set_weights_message( - cwtensor=self, - wallet=wallet, - netuid=netuid, - uids=uids, - weights=weights, - version_key=version_key, - wait_for_finalization=wait_for_finalization, - prompt=prompt, - ) - except Exception as e: - cybertensor.logging.error(f"Error setting weights: {e}") - finally: - retries += 1 + # while ( + # self.blocks_since_last_update(netuid, uid) > self.weights_rate_limit(netuid) # type: ignore + # and retries < max_retries + # ): + try: + success, message = set_weights_message( + cwtensor=self, + wallet=wallet, + netuid=netuid, + uids=uids, + weights=weights, + version_key=version_key, + wait_for_finalization=wait_for_finalization, + prompt=prompt, + ) + except Exception as e: + cybertensor.logging.error(f"Error setting weights: {e}") + # finally: + # retries += 1 return success, message @@ -1548,6 +1548,50 @@ def subnetwork_n(self, netuid: int, block: Optional[int] = None) -> Optional[int return subnet_info.subnetwork_n + # def max_n(self, netuid: int, block: Optional[int] = None) -> Optional[int]: + # """Returns network MaxAllowedUids hyper parameter""" + # if not self.subnet_exists(netuid, block): + # return None + # _res = self.contract.query( + # {"max_allowed_uids": {"netuid": netuid}} + # ) + # if _res is None: + # return None + # return _res + # + # def blocks_since_epoch( + # self, netuid: int, block: Optional[int] = None + # ) -> Optional[int]: + # """Returns network BlocksSinceLastStep hyper parameter""" + # if not self.subnet_exists(netuid, block): + # return None + # _res = self.contract.query( + # {"block_since_last_step": {"netuid": netuid}} + # ) + # if _res is None: + # return None + # return _res + + # def blocks_since_last_update(self, netuid: int, uid: int) -> Optional[int]: + # if not self.subnet_exists(netuid): + # return None + # _res = self.contract.query( + # {"block_since_last_update": {"netuid": netuid, "uid": uid}} + # ) + # if _res is None: + # return None + # return _res + + # def weights_rate_limit(self, netuid: int) -> Optional[int]: + # if not self.subnet_exists(netuid): + # return None + # _res = self.contract.query( + # {"weights_set_rate_limit": {"netuid": netuid}} + # ) + # if _res is None: + # return None + # return _res + def tempo(self, netuid: int, block: Optional[int] = None) -> Optional[int]: """Returns network Tempo hyperparameter""" tempo = self.contract.query({"get_tempo": {"netuid": netuid}}) diff --git a/cybertensor/wallet.py b/cybertensor/wallet.py index 10f26f5..60fbd11 100644 --- a/cybertensor/wallet.py +++ b/cybertensor/wallet.py @@ -137,13 +137,6 @@ def add_args(cls, parser: argparse.ArgumentParser, prefix: str = None): default_name = os.getenv("CT_WALLET_NAME") or "default" default_hotkey = os.getenv("CT_WALLET_NAME") or "default" default_path = os.getenv("CT_WALLET_PATH") or "~/.cybertensor/wallets/" - parser.add_argument( - "--no_prompt", - dest="no_prompt", - action="store_true", - help="""Set true to avoid prompting the user.""", - default=False, - ) parser.add_argument( "--" + prefix_str + "wallet.name", required=False, @@ -163,7 +156,15 @@ def add_args(cls, parser: argparse.ArgumentParser, prefix: str = None): default=default_path, help="The path to your cybertensor wallets", ) + parser.add_argument( + "--no_prompt", + dest="no_prompt", + action="store_true", + help="""Set true to avoid prompting the user.""", + default=False, + ) except argparse.ArgumentError as e: + print(f'ArgumentError {e}') pass def __init__(