Skip to content

Commit 8256369

Browse files
authored
v2.7.0 (#350)
Changes: - New multi-choice benchmarking task; - Refactor changes (.env config-based, decoupled parts of the code); - Poetry setup; - Only 5 tasks are included: QA, DateQA, Summary, MultiChoice, Organic.
1 parent d2e90b2 commit 8256369

File tree

132 files changed

+12436
-7728
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+12436
-7728
lines changed

.env.miner.example

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# The network UID [1, 61]
2+
NETUID=61
3+
4+
# The network name [test, finney, local]
5+
SUBTENSOR_NETWORK = "test"
6+
7+
# The chain endpoint, only required to be set if you run local.
8+
SUBTENSOR_CHAIN_ENDPOINT = None
9+
10+
# The name of your wallet.
11+
WALLET_NAME="miner"
12+
13+
# The name of the hotkey associated with the validator wallet.
14+
HOTKEY="default"
15+
16+
# Open port which can be used to connect to the network.
17+
AXON_PORT=22116
18+
19+
# The OpenAI API key (only needed for the OpenAI test miner).
20+
OPENAI_API_KEY="YOUR_API_HERE"

.env.validator.example

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# The network UID. If 1 for main, 61 for testnet.
2+
NETUID=61
3+
4+
# The network name [test, finney, local].
5+
SUBTENSOR_NETWORK = "test"
6+
7+
# The chain endpoint, only required to be set if you run local.
8+
SUBTENSOR_CHAIN_ENDPOINT = None
9+
10+
# The name of your wallet.
11+
WALLET_NAME="validator"
12+
13+
# The name of the hotkey associated with the validator wallet.
14+
HOTKEY="default"
15+
16+
# Open port which can be used to connect to the network.
17+
AXON_PORT=22116
18+
19+
# HuggingFace Access Token.
20+
HF_TOKEN=""

.github/workflows/python-package.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ name: Prompting CI/CD
55

66
on:
77
push:
8-
98
jobs:
109
build:
11-
1210
runs-on: ubuntu-latest
1311
strategy:
1412
fail-fast: false
@@ -24,19 +22,16 @@ jobs:
2422
- name: Install dependencies
2523
run: |
2624
python -m pip install --upgrade pip
27-
python -m pip install flake8 pytest black
2825
bash install.sh
29-
30-
- name: Lint with flake8
31-
run: |
32-
# stop the build if there are Python syntax errors or undefined names
33-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
34-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
35-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
36-
- name: Black
26+
poetry install --all-extras
27+
poetry run pip uninstall -y uvloop
28+
- name: Debug Environment
3729
run: |
38-
black .
30+
poetry run python -V
31+
poetry run which python
32+
poetry env info
33+
poetry run pip list
3934
- name: Test with pytest
4035
run: |
4136
# run tests in tests/ dir and only fail if there are failures or errors
42-
pytest tests/ --verbose --failed-first --exitfirst --disable-warnings
37+
poetry run pytest tests/ --verbose --failed-first --exitfirst --disable-warnings

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ __pycache__/
55
.DS_Store
66
**/.DS_Store
77

8+
*.npz
9+
prompting/storage/
810

911
# C extensions
1012
*.so
@@ -124,6 +126,8 @@ celerybeat.pid
124126

125127
# Environments
126128
.env
129+
.env.miner
130+
.env.validator
127131
.venv
128132
env/
129133
venv/
@@ -165,8 +169,7 @@ cython_debug/
165169
testing/
166170
data/*
167171
plots/*
168-
notebooks/*
169172
core
170173
app.config.js
171174
wandb
172-
.vscode
175+
.vscode

.pre-commit-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.3.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- repo: https://github.com/astral-sh/ruff-pre-commit
9+
# Ruff version.
10+
rev: v0.5.2
11+
hooks:
12+
# Run the linter.
13+
- id: ruff
14+
args: [ --fix ]
15+
# Run the formatter.
16+
- id: ruff-format

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
SHELL:=/bin/bash
22

33
promote-changes:
4-
./scripts/promote_changes.sh
4+
./scripts/promote_changes.sh

README.md

Lines changed: 6 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# **Bittensor SN1** <!-- omit in toc -->
1010
[![Discord Chat](https://img.shields.io/discord/308323056592486420.svg)](https://discord.gg/bittensor)
11-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
1212

1313
---
1414

@@ -24,98 +24,18 @@ This repository is the **official codebase for Bittensor Subnet 1 (SN1) v1.0.0+,
2424

2525
# Introduction
2626

27-
This repo defines an incentive mechanism to create a distributed conversational AI for Subnet 1 (SN1).
27+
This repo defines an incentive mechanism to create a distributed conversational AI for Subnet 1 (SN1).
2828

29-
Validators and miners are based on large language models (LLM). The validation process uses **internet-scale datasets and goal-driven behaviour to drive human-like conversations**.
29+
Validators and miners are based on large language models (LLM). The validation process uses **internet-scale datasets and goal-driven behaviour to drive human-like conversations**.
3030

3131

3232
</div>
3333

34-
# Installation
35-
This repository requires python3.9 or higher. To install it, simply clone this repository and run the [install.sh](./install.sh) script.
36-
```bash
37-
git clone https://github.com/opentensor/prompting.git
38-
cd prompting
39-
bash install.sh
40-
```
41-
If you are running a miner, you will also need to uninstall uvloop.
42-
```bash
43-
pip uninstall uvloop -y
44-
```
45-
46-
If you are running a validator, logging in to Hugging Face is required:
47-
```shell
48-
huggingface-cli login
49-
```
50-
You also need to accept the License Agreement for the LMSYS-Chat-1M dataset: https://huggingface.co/datasets/lmsys/lmsys-chat-1m
34+
# Usage
5135

52-
</div>
36+
<div align="center">
5337

54-
# Compute Requirements
38+
**[For Validators](./assets/validator.md)** · **[For Miners](./assets/miner.md)**
5539

56-
1. To run a **validator**, you will need at least 62GB of VRAM.
57-
2. To run the default huggingface **miner**, you will need at least 62GB of VRAM.
5840

59-
60-
**It is important to note that the baseminers are not recommended for main, and exist purely as an example. Running a base miner on main will result in no emissions and a loss in your registration fee.**
61-
If you have any questions please reach out in the SN1 channel in the Bittensor Discord.
6241
</div>
63-
64-
# How to Run
65-
You can use the following command to run a miner or a validator.
66-
67-
```bash
68-
python <SCRIPT_PATH>
69-
--netuid 1
70-
--subtensor.network <finney/local/test>
71-
--neuron.device cuda
72-
--wallet.name <your wallet> # Must be created using the bittensor-cli
73-
--wallet.hotkey <your hotkey> # Must be created using the bittensor-cli
74-
--logging.debug # Run in debug mode, alternatively --logging.trace for trace mode
75-
--axon.port # VERY IMPORTANT: set the port to be one of the open TCP ports on your machine
76-
```
77-
78-
where `SCRIPT_PATH` is either:
79-
1. neurons/miners/openai/miner.py
80-
2. neurons/validator.py
81-
82-
For ease of use, you can run the scripts as well with PM2. Installation of PM2 is:
83-
**On Linux**:
84-
```bash
85-
sudo apt update && sudo apt install jq && sudo apt install npm && sudo npm install pm2 -g && pm2 update
86-
```
87-
88-
Example of running an Openai miner on Main:
89-
90-
```bash
91-
pm2 start neurons/miners/openai/miner.py --interpreter python --name openai_miner -- --netuid 1 --subtensor.network finney --wallet.name my_wallet --wallet.hotkey my_hotkey --neuron.model_id gpt-3.5-turbo-1106 --axon.port 8091
92-
```
93-
94-
## Running with autoupdate
95-
96-
You can run the validator in auto-update mode by using pm2 along with the `run.sh` bash script. This command will initiate two pm2 processes: one for auto-update monitoring, named **s1_validator_update**, and another for running the validator itself, named **s1_validator_main_process**.
97-
```bash
98-
pm2 start run.sh --name s1_validator_autoupdate -- --wallet.name <your-wallet-name> --wallet.hotkey <your-wallet-hot-key>
99-
```
100-
101-
> Note: this is not an end solution, major releases or changes in requirements will still require you to manually restart the processes. Regularly monitor the health of your validator to ensure optimal performance.
102-
103-
# Testnet
104-
We highly recommend that you run your miners on testnet before deploying on main. This is give you an opportunity to debug your systems, and ensure that you will not lose valuable immunity time. The SN1 testnet is **netuid 61**.
105-
106-
In order to run on testnet, you will need to go through the same hotkey registration proceure as on main, but using **testtao**. You will need to ask for some in the community discord if you do not have any.
107-
108-
To run:
109-
110-
```bash
111-
pm2 start neurons/miners/openai/miner.py --interpreter python3 --name openai_miner -- --netuid 61 --subtensor.network test --wallet.name my_test_wallet --wallet.hotkey my_test_hotkey --neuron.model_id gpt-3.5-turbo-1106 --axon.port 8091
112-
```
113-
114-
# Limitations
115-
> Important: vLLM currently faces a [notable limitation](https://github.com/vllm-project/vllm/issues/3012) in designating a specific GPU for model execution via code. Consequently, to employ a particular CUDA device for your model's operations, it's necessary to manually adjust your environment variable `CUDA_VISIBLE_DEVICES`. For instance, setting `export CUDA_VISIBLE_DEVICES=1,2` will explicitly define the CUDA devices available for use.
116-
117-
# Resources
118-
The archiecture and methodology of SN1 is complex, and as such we have created a comprehensive resource to outline our design. Furthermore, we have strict requirements for how miners should interact with the network. Below are the currently available resources for additional information:
119-
120-
1. [SN1 architecture details](docs/SN1_validation.md)
121-
2. [StreamMiner requirements](docs/stream_miner_template.md)

assets/miner.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# **Miners**
2+
3+
# ⚠️ **DISCLAIMER** ⚠️ **DO NOT RUN THIS MINER ON MAINNET!**
4+
5+
> **The openai miner provided in this repo is _not intended_ to be run on mainnet!**
6+
>
7+
> **If you run the base miner on mainnet, you will not earn anything!**
8+
> It is provided as an example to help you build your own custom mining operation!
9+
>
10+
## Compute Requirements
11+
12+
| Resource | Requirement |
13+
|---------------|-------------------|
14+
| **VRAM** | None |
15+
| **vCPU** | 8 vCPU |
16+
| **RAM** | 8 GB |
17+
| **Storage** | 80 GB |
18+
19+
## Installation
20+
21+
Clone this repository and run the [install.sh](./install.sh) script.
22+
23+
```bash
24+
git clone https://github.com/opentensor/prompting.git
25+
cd prompting
26+
bash install.sh
27+
```
28+
29+
## Configuration
30+
⚠️ **Reminder! Do not run this miner on main!** ⚠️
31+
Before running a miner, you will need to create a .env.miner environment file. It is necessary for you to provide the following
32+
33+
```text
34+
NETUID= #[1, 61, 102]
35+
SUBTENSOR_NETWORK= #The network name [test, main, local]
36+
SUBTENSOR_CHAIN_ENDPOINT= #The chain endpoint [test if running on test, main if running on main, custom endpoint if running on local]
37+
WALLET_NAME= #Name of your wallet(coldkey)
38+
HOTKEY= #Name of your hotkey associated with above wallet
39+
AXON_PORT= #Number of the open tcp port
40+
OPENAI_API_KEY= #The openai key that you would like to mine with
41+
```
42+
## Testnet - RECOMMENDED
43+
We highly recommend that you run your miners on testnet before deploying on main. This is give you an opportunity to debug your systems, and ensure that you will not lose valuable immunity time. The SN1 testnet is **netuid 61**.
44+
45+
In order to run on testnet, you will need to go through the same hotkey registration proceure as on main, but using **testtao**. You will need to ask for some in the community discord if you do not have any.
46+
47+
Then, simply set test=True in your .env file and execute all other steps as before.
48+
49+
Then post in the Subnet 1 channel on discord so we can activate a validator for your miner to respond to.
50+
51+
You can use wandb to see how successful your miner would be on mainnet, an example notebook is pinned in the channel.
52+
53+
## Running
54+
55+
After creating the above environment file, run
56+
57+
```bash
58+
pm2 start "poetry run python neurons/miners/openai/miner.py"
59+
```

assets/validator.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# **VALIDATORS**
2+
3+
## Compute Requirements
4+
5+
| Resource | Requirement |
6+
|---------------|-------------------|
7+
| **VRAM** | 62 GB |
8+
| **vCPU** | 24 vCPU |
9+
| **RAM** | 60 GB |
10+
| **Storage** | 150 GB |
11+
12+
## Installation
13+
14+
Clone this repository and run the [install.sh](./install.sh) script.
15+
16+
```bash
17+
git clone https://github.com/opentensor/prompting.git
18+
cd prompting
19+
bash install.sh
20+
```
21+
22+
You will also need to log into huggingface and accept the License Agreement for the LMSYS-Chat-1M dataset: https://huggingface.co/datasets/lmsys/lmsys-chat-1m :
23+
```shell
24+
huggingface-cli login
25+
```
26+
27+
## Configuration
28+
29+
Before running a validator, you will need to create a .env.validator environment file. It is necessary for you to provide the following
30+
31+
```text
32+
NETUID= #[1, 61, 102]
33+
SUBTENSOR_NETWORK= #The network name [test, main, local]
34+
SUBTENSOR_CHAIN_ENDPOINT= #The chain endpoint [test if running on test, main if running on main, custom endpoint if running on local]
35+
WALLET_NAME= #Name of your wallet(coldkey)
36+
HOTKEY= #Name of your hotkey associated with above wallet
37+
AXON_PORT= #Number of the open tcp port
38+
HF_TOKEN= #Access token from Hugging Face where you accepted the License Agreement for lmsys
39+
```
40+
41+
## Running
42+
43+
After creating the above environment file, run
44+
45+
```bash
46+
bash run.sh
47+
```
48+
It will spawn 2 pm2 processes, one to run the validator and one to autoupdate.
49+
50+
> Note: this is not an end solution, major releases or changes in requirements will still require you to manually restart the processes. Regularly monitor the health of your validator to ensure optimal performance.

0 commit comments

Comments
 (0)