/text-prompting

Primary LanguagePythonMIT LicenseMIT

⚠️ Deprecated: This project is no longer maintained. We recommend using the new prompting repository instead.

Bittensor Text-Prompting

Discord Chat License: MIT


The Incentivized Internet

DiscordNetworkResearch


This template contains all the necessary files and functions to run Bittensor's Text-Prompting Subnet. You can try running miners on netuid 8 in Bittensor's test network.

Introduction

The Bittensor blockchain hosts multiple self-contained incentive mechanisms 'subnets'. Subnets are playing fields through which miners (those producing value) and validators (those producing consensus) determine together the proper distribution of TAO for the purpose of incentivizing the creation of value, i.e. generating digital commodities, such as intelligence, or data. Each consists of a wire protocol through which miners and validators interact and their method of interacting with Bittensor's chain consensus engine Yuma Consensus which is designed to drive these actors into agreement about who is creating value.

This repository is a subnet for text prompting with large language models (LLM). Inside, you will find miners and validators designed by the OpenTensor Foundation team to valdiate and serve language models. The current validator implementation queries the network for responses while servers responds to requests with their best completions. These completions are judged and ranked by the validators and passed to the chain.


Installation

This repository requires python3.8 or higher. To install, simply clone this repository and install the requirements.

git clone https://github.com/opentensor/text-prompting.git
cd text-prompting
python -m pip install -r requirements.txt
python -m pip install -e .

If you are running a specific server, you might need install server-specific requirements.

cd neurons/miners/bittensorLM
python -m pip install -r requirements.txt

Prior to running a miner or validator, you must create a wallet and register the wallet to a netuid. Once you have done so, you can run the miner and validator with the following commands.

# To run the miner
python -m neurons/miners/bittensorLM/miner.py 
    --netuid 8  
    --subtensor.network test 
    --wallet.name <your miner wallet> # Must be created using the bittensor-cli
    --wallet.hotkey <your validator hotkey> # Must be created using the bittensor-cli
    --logging.debug # Run in debug mode, alternatively --logging.trace for trace mode

# To run the validator
python -m neurons/validators/validator.py
    --netuid 8
    --subtensor.network test 
    --wallet.name <your validator wallet>  # Must be created using the bittensor-cli
    --wallet.hotkey <your validator hotkey> # Must be created using the bittensor-cli
    --logging.debug # Run in debug mode, alternatively --logging.trace for trace mode

Running

These validators are designed to run and update themselves automatically. To run a validator, follow these steps:

  1. Install this repository, you can do so by following the steps outlined in the installation section.
  2. Install Weights and Biases and run wandb login within this repository. This will initialize Weights and Biases, enabling you to view KPIs and Metrics on your validator. (Strongly recommended to help the network improve from data sharing)
  3. Install PM2 and the jq package on your system. On Linux:
    sudo apt update && sudo apt install jq && sudo apt install npm && sudo npm install pm2 -g && pm2 update
    On Mac OS
    brew update && brew install jq && brew install npm && sudo npm install pm2 -g && pm2 update
  4. Run the run.sh script which will handle running your validator and pulling the latest updates as they are issued.
    pm2 start run.sh --name text_prompt_validators_autoupdate -- --wallet.name <your-wallet-name> --wallet.hotkey <your-wallet-hot-key>

This will run two PM2 process: one for the validator which is called text_prompt_validators_main_process by default (you can change this in run.sh), and one for the run.sh script (in step 4, we named it text_prompt_validators_autoupdate). The script will check for updates every 30 minutes, if there is an update then it will pull it, install it, restart text_prompt_validators_main_process and then restart itself.

Real-time monitoring with wandb integration

By default, the text prompting validator sends data to wandb, allowing users to monitor running validators and access key metrics in real time, such as:

  • Gating model loss
  • Hardware usage
  • Forward pass time
  • Block duration

All the data sent to wandb is publicly available to the community at the following link.

You don't need to have a wandb account to access the data or to generate a new run, but bear in mind that data generated by anonymous users will be deleted after 7 days as default wandb policy.

License

This repository is licensed under the MIT License.

# The MIT License (MIT)
# Copyright © 2023 Yuma Rao

# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all copies or substantial portions of
# the Software.

# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
# THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.