masa-finance / masa-bittensor

Masa Bittensor Subnet - Decentralized, Fair AI
https://masa.ai
MIT License
14 stars 11 forks source link

spike: research new BTCLI version #255

Closed hide-on-bush-x closed 1 month ago

hide-on-bush-x commented 2 months ago

Research BTCLI 8.0

hide-on-bush-x commented 1 month ago

Updating bittensor

It is suggested to create a new virtual environment for this

conda create -n bt
conda activate bt

Update bittensor library

pip install "bittensor[cli]"
pip install "bittensor[sdk]"
pip install bittensor-wallet

double check that the library is correctly installed

pip list

You should see something similar to the following list

bittensor                 8.1.0
bittensor-cli             8.1.0
bittensor-wallet          2.0.1

Issues

List of found issues when trying to run subnet 42

Config object issues

when trying to run a validator I am facing an error with the config object and the wallet class Command:

python neurons/validator.py --netuid 165 --subtensor.network test --wallet.name validator --wallet.hotkey default --logging.debug --axon.port 8092 --neuron.debug

Output:

TypeError: argument 'config': 'Config' object cannot be converted to 'Config'

This error is happening on base/neuron.py file

│                                                                                                  │
│    94 │   │   │   self.subtensor = MockSubtensor(self.config.netuid, wallet=self.wallet)         │
│    95 │   │   │   self.metagraph = MockMetagraph(self.config.netuid, subtensor=self.subtensor)   │
│    96 │   │   else:                                                                              │
│ ❱  97 │   │   │   self.wallet = bt.Wallet(config=self.config)                                    │
│    98 │   │   │   self.subtensor = bt.Subtensor(config=self.config)                              │
│    99 │   │   │   self.metagraph = self.subtensor.metagraph(self.config.netuid)  

Failed solutions

List of attempts already tried

1# new config file

There is a new config file seems to be important but its just a base configuration, didn't affect this issue docs: https://docs.bittensor.com/btcli#config community message reference: https://discord.com/channels/1120750674595024897/1242998447125037106/1290369105412755600

2# dealing with the config object on base neuron

The way the config object is created is the following

        base_config = copy.deepcopy(config or BaseNeuron.config()) # Gets base configuration from config file
        self.config = self.config() # Config coming from command parameters
        self.config.merge(base_config) # Joins both configs
        self.check_config(self.config) 

By logging

 isinstance(self.config, bt.Config)

we can deduce that self.config is in fact a Config object

When logging

dir(self.config)

output: ['__is_set', 'axon', 'config', 'enable_validator_api', 'logging', 'mock', 'netuid', 'neuron', 'no_prompt', 'no_version_checking', 'strict', 'subtensor', 'wallet', 'wandb']

we can see that all the configs defined in the config.py file are there and seems fine

Tried doing

bt.Wallet(config=self.config.config)

But more errors rised and errors like "default wallet is not in the wallet list" showed up, what tells me that doing that only uses default configs

Ideas to explore

grantdfoster commented 1 month ago

About to replicate, but based on these comments my first reaction is that it seems the issues are explicitly stemming from calls to bt.Wallet().

After catching up with the docs, it looks like the new bittensor-wallet library is in fact auto-installed when you install the BTCLI / SDK, but these are just my initial reactions!

p.s. great explanation of the situation and what you've attempted to do, super helpful!

hide-on-bush-x commented 1 month ago

Oh that new wallet import may make the difference, will double check, thank you!

hide-on-bush-x commented 1 month ago

There is a new Config object with just wallet configuration, this is used in the new Wallet class, this class is called Config Before this new version we used the regular config object that has every config in it, this config object class was also called Config . Here is where the confussion started and why this error now makes sense TypeError: argument 'config': 'Config' object cannot be converted to 'Config' I hate that there was no disclaimer about this or nobody saying nothing on the discord channels :melting_face: Solution: Create a new config object just for bt.wallet and insert the required values from the main config wallet_specific_config = Config( hotkey=self.config.wallet.hotkey, name=self.config.wallet.name )

        self.wallet = bt.wallet(config=wallet_specific_config)