prompting.baseminer.set_weights#

Module Contents#

Functions#

set_weights(subtensor, netuid, uid, wallet[, wandb_on])

Sets the miner's weights on the Bittensor network.

prompting.baseminer.set_weights.set_weights(subtensor, netuid, uid, wallet, wandb_on=False)#

Sets the miner’s weights on the Bittensor network.

This function 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.

The function performs the following steps: 1. Queries the Bittensor network for the total number of peers. 2. Sets a weight vector with a value of 1 for the current miner and 0 for all other peers. 3. Updates these weights on the Bittensor network using the set_weights method of the subtensor. 4. Optionally logs the weight-setting operation to Weights & Biases (wandb) for monitoring.

Parameters:
  • subtensor (bt.subtensor) – The Bittensor object managing the blockchain connection.

  • netuid (int) – The unique identifier for the chain subnet.

  • uid (int) – The unique identifier for the miner on the network.

  • wallet (bt.wallet) – The miner’s wallet holding cryptographic information.

  • wandb_on (bool, optional) – Flag to determine if logging to Weights & Biases is enabled. Defaults to False.

Raises:

Exception – If there’s an error while setting weights, the exception is logged for diagnosis.

Return type:

None