Skip to content

Commit

Permalink
Merge pull request #16 from opentensor/docs-updates
Browse files Browse the repository at this point in the history
miner/validator markdown
  • Loading branch information
ifrit98 committed Sep 26, 2023
2 parents 280d849 + ddc9a3c commit c7026b4
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 31 deletions.
57 changes: 39 additions & 18 deletions docs/running_a_miner.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,48 @@
# Setup
Install the text-prompting repository. We recommend using pm2 to manage your processes. Install [here](https://pm2.io/docs/runtime/guide/installation/)
# Bittensor (Vicuna) Miner Setup Guide

We will show how to run a vicuna miner below:
This guide provides detailed instructions for setting up and running a Bittensor Vicuna miner using the text-prompting repository.

```bash
## Prerequisites
Before you begin, ensure that you have PM2 installed to manage your processes. If you don’t have it installed, follow the installation guide [here](https://pm2.io/docs/runtime/guide/installation/).

## 1. Install the text-prompting Repository
To start, install the text-prompting repository. Navigate to the directory where you’ve cloned or downloaded `text_prompting`, and run the following command:

```sh
python -m pip install -e ~/text_prompting
```

Install the requirements for your specific miner. (if they exist)
```bash
## 2. Install Specific Miner Requirements
If there are any additional requirements for your miner, install them by running:

```sh
python -m pip install -r ~/text_prompting/miners/vicuna/requirements.txt
```

Load it up:
```bash
CUDA_VISIBLE_DEVICES=0 pm2 start ~/text_prompting/neurons/miners/vicuna/miner.py \\
--name vicuna \\
--interpreter <path-to-python-binary> -- \\
--vicuna.model_name TheBloke/Wizard-Vicuna-7B-Uncensored-HF \\ # This can be changed to any Vicuna style model
--wallet.name <wallet-name> \\
--wallet.hotkey <wallet-hotkey> \\
--netuid <netuid> \\ # netuid 8 is on testnet currently
--subtensor.network <network> \\ (finney, test, local, etc)
--logging.debug \\ # set your desired logging level
## 3. Load and Run the Miner
Once you have installed the necessary packages, you can load and run the miner using PM2. Set the `CUDA_VISIBLE_DEVICES` variable to the GPU you want to use, and adjust the other variables according to your setup.

```sh
CUDA_VISIBLE_DEVICES=0 pm2 start ~/text_prompting/neurons/miners/vicuna/miner.py \
--name vicuna \
--interpreter <path-to-python-binary> -- \
--vicuna.model_name TheBloke/Wizard-Vicuna-7B-Uncensored-HF \
--wallet.name <wallet-name> \
--wallet.hotkey <wallet-hotkey> \
--netuid <netuid> \
--subtensor.network <network> \
--logging.debug \
--axon.port <port>
```
```

### Variable Explanation
- `--vicuna.model_name`: Specify any Vicuna style model.
- `--wallet.name`: Provide the name of your wallet.
- `--wallet.hotkey`: Enter your wallet's hotkey.
- `--netuid`: Use `8` for testnet.
- `--subtensor.network`: Specify the network you want to use (`finney`, `test`, `local`, etc).
- `--logging.debug`: Adjust the logging level according to your preference.
- `--axon.port`: Specify the port number you want to use.

## Conclusion
By following this guide, you should be able to setup and run a Vicuna miner using the text-prompting repository with PM2. Ensure that you monitor your processes and check the logs regularly for any issues or important information. For more details or if you encounter any problems, refer to the official documentation or seek help from the community.
95 changes: 82 additions & 13 deletions docs/running_a_validator.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,92 @@
# Setup
# Bittensor Validator Setup Guide

This document outlines the steps to set up and run a Bittensor node using the text-prompting repository on the testnet. You can mirror the same but change `--subtensor.network` to `finney`, `local`, or your own endpoint with `--subtensor.chain_endpoint <ENDPOINT>`. Follow the instructions below to set up your environment, install necessary packages, and start the Bittensor process.

We recommend using `pm2` to manage your processes. See the pm2 install [guide](https://pm2.io/docs/runtime/guide/installation/) for more info.

## Hardware requirements:
- Recommended: A100 80GB
- Minimum: A40 48GB or A6000 48GB

## Run command
`CUDA_VISIBLE_DEVICES=0 pm2 start ~/text_prompting/neurons/validators/validator.py \\ # path to the repo
--name <your-validator-name> \\
--interpreter <path-to-your-env-python> -- \\
--wallet.name <validator-wallet> --netuid <netuid> \\ # netuid 8 is currently test netuid
--wallet.hotkey <validator-hotkey> \\
--subtensor.network <network> \\ (finney, local, test, etc)
--logging.debug \\ # set desired logging level
--neuron.reward_path ~/.bittensor/validators \\ # where to store logs
--axon.port <port> \\
--neuron.followup_sample_size <k> \\# This sets top-k for the followup prompts
--neuron.answer_sample_size <k> \\ # This sets top-k for answer prompts
## 0. Install Conda Environment
Create a new conda environment named `val` with Python 3.10.

```sh
conda create -n val python=3.10
```

Activate the conda environment:

```sh
conda activate val
```

## 1. Install Bittensor

Install the Bittensor paåckage directly from the GitHub repository on the `revolution` branch.

```sh
python -m pip install git+https://github.com/opentensor/bittensor.git@revolution
```

## 2. Clone the text-prompting repository
Clone the text-prompting repository and install the package in editable mode.

```sh
git clone https://github.com/opentensor/text-prompting.git
cd text-prompting
python -m pip install -e .
```

## 3. Set up Your Wallet
Create new cold and hot keys for your wallet:

```sh
btcli wallet new_coldkey
btcli wallet new_hotkey
```

### 3.1 Get some TAO
Use the faucet command to get some TAO for your wallet on the test network (or get real Tao on mainnet by purchasing OTC or mining yourself):

```sh
btcli wallet faucet --wallet.name validator --subtensor.network test
```

## 4. Register your UID on the Network
Register your UID on the test network:

```sh
btcli wallet recycle_register --subtensor.network test
```

## 5. Start the Process
Check which GPUs are available by running:

```sh
nvidia-smi
```

Launch the process using `pm2` and specify the GPU to use by setting the `CUDA_VISIBLE_DEVICES` variable. Adjust the following command to your local paths, available GPUs, and other preferences:

```sh
CUDA_VISIBLE_DEVICES=1 pm2 start ~/tutorial/text-prompting/neurons/validators/validator.py \
--name validator1 --interpreter ~/miniconda3/envs/val/bin/python -- \
--wallet.name validator --netuid 8 --wallet.hotkey vali --subtensor.network test \
--logging.debug --neuron.reward_path ~/.bittensor/test-subnet1-validators \
--axon.port 8899 --neuron.followup_sample_size 2 --neuron.answer_sample_size 2
```

## 6. Monitor Your Process
Use the following `pm2` commands to monitor the status and logs of your process:

```sh
pm2 status
pm2 logs 0
```

# Conclusion
By following the steps above, you should have successfully set up and started a Bittensor node using the text-prompting repository. Make sure to monitor your process regularly and ensure that it's running smoothly. If you encounter any issues or have any questions, refer to the [Bittensor documentation](https://github.com/opentensor/text-prompting/docs/) or seek help from the community.


> Note: Make sure you have at least >50GB free disk space for wandb logs.

0 comments on commit c7026b4

Please sign in to comment.