The subnet uses Bittensor's incentive system to reward computers for producing gradients which maximially reduce the loss on the model architecture hosted by the subnet owner. The use of S3 buckets factilitates high bandwidth communication between peers.
To install the necessary dependencies for this project, please ensure you have Python 3.6 or higher installed on your system. Then, follow these steps:
- Clone the repository to your local machine:
git clone https://github.com/YumaRao/gradient.git
- Navigate to the cloned repository directory:
cd gradient
- Install the required Python packages:
pip install -r requirements.txt
- Install the repository
python3 -m pip install -e.
Before running a miner or validator, you need to set up an S3 bucket on AWS and configure your environment to use AWS credentials. Follow these steps to get started:
If you don't already have an AWS account, go to the AWS homepage and sign up.
- Log in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/.
- Click Create bucket.
- Provide a unique name for your bucket and select the AWS Region where you want the bucket to reside.
- Follow the on-screen instructions to configure options and set permissions. For most use cases, the default settings will suffice.
- Click Create bucket to finalize.
- Navigate to the IAM console at https://console.aws.amazon.com/iam/.
- In the navigation pane, choose Users, then Add user.
- Enter a user name, select Programmatic access for the AWS access type, and click Next: Permissions.
- Choose Attach existing policies directly and select the AmazonS3FullAccess policy.
- Follow the rest of the on-screen instructions to create the user. After the user is created, you'll be provided with an Access key ID and a Secret access key. Make a note of these credentials.
To securely manage your AWS credentials, you will create a .env
file in your project's root directory and add your credentials to it. Follow these steps:
- Open a terminal and navigate to the root directory of your project.
- Run the following commands to create a
.env
file and add your AWS credentials to it. ReplaceYOUR_ACCESS_KEY_ID
andYOUR_SECRET_ACCESS_KEY
with the credentials obtained in the previous step:touch .env echo "AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY_ID" >> .env echo "AWS_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY" >> .env
To run a miner, you will need to execute the neurons/miner.py
script, which is responsible for the mining process. This script handles the training of the model on your local machine, calculates the delta (the difference between the newly trained model and the master model), and then pushes this delta back to the network.
Here are the steps to run a miner:
- Ensure you have followed the installation instructions and have all the necessary dependencies installed.
- Run the miner by executing the following command:
python neurons/miner.py --device <device> --wallet.name <your wallet name> --wallet.hotkey <your wallet hotkey>
- The miner will start training the model locally. Progress will be shown in the terminal, including the loss after each epoch and a success message when a delta is pushed successfully.
- To stop the miner, simply interrupt the process in your terminal (e.g., by pressing
Ctrl+C
).
Running a validator involves evaluating the deltas (changes) made by miners to the model and scoring them based on their impact on the model's performance. Validators play a crucial role in ensuring the quality and integrity of updates to the model. Follow the steps below to run a validator:
- Ensure you have followed the installation instructions and have all the necessary dependencies installed.
- Run the validator by executing the following command:
python validator.py --device <device> --wallet.name <your wallet name> --wallet.hotkey <your wallet hotkey>