You must have the following things:
- System with at least 12gb of VRAM
- Python >=3.10
- OpenAI API key
- Anthropic API Key
- Google Gemini API Key
- OpenRouter api key
- Github Token
- Wandb account
- Docker on validator machine
- Docker on a docker server (see below, digital ocean droplet is recommended)
- Optional: Corcel API Key
This repository requires python3.11, follow the commands below to install it if you do not already have it.
ONLY RUN THE FOLLOWING COMMANDS IF YOU DO NOT HAVE PYTHON INSTALLED
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.11 python3.11-venvEnsure that your python version is 3.11 before continuing:
python3 --versionIf the above doesnt return python3.11 try using the command python3.11 instead. If the cmd python3.11 works, use that in place of every python command below.
YOU WILL GET SOME ERRORS ABOUT THE PYTHON VERSION, IGNORE THEM.
After ensuring you have python run the following commands:
git clone https://github.com/brokespace/code
cd code
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --use-deprecated=legacy-resolver -r requirements.txt
python3 -m pip install --use-deprecated=legacy-resolver -e .
python3 -m pip uninstall uvloop # b/c it causes issues with threading/loopsCopy .env.example to .env - cp .env.example .env. Then edit the .env file with the github token you get below
We require github tokens, to get one follow the instructions here, or below.
- Go to Github
- Open the top right menu and select
Settings - Go to the bottom left and select
Developer Settings - Go to either
Tokens (classic)orFine-grained tokens - Generate a new token and place it in the .env
To use OpenAI's services, you need to obtain an API key. Follow the steps below to get your OpenAI API key:
- Go to the OpenAI website.
- Sign up for an account if you don't already have one, or log in if you do.
- Navigate to the API section of your account.
- Generate a new API key.
- Copy the API key and store it in a secure location.
Once you have your OpenAI API key, add it to your .env file like this:
OPENAI_API_KEY=<your openai api key>
This step is optional but recommended to reduce validating costs.
Head to Corcel and sign up for an account.
Once you have an account, create an API key and place it in the .env file like this:
CORCEL_API_KEY=<your corcel api key>
As a validator you will need to use the Chutes API to validate the miner submissions.
Instructions for getting an API Key can be found here.
Place the api key in the .env file like this:
CHUTES_API_KEY=<your chutes api key>
Place the api key in the .env file like this:
ANTHROPIC_API_KEY=<your anthropic api key>
Place the api key in the .env file like this:
GOOGLE_API_KEY=<your gemini api key>
Place the api key in the .env file like this:
OPENROUTER_API_KEY=<your openrouter api key>
See instructions here
Ensure that the default user has access to the docker daemon.
sudo usermod -aG docker $USER
sudo chmod 666 /var/run/docker.sockUpdate the /etc/docker/daemon.json file with the following content:
{
"insecure-registries": ["<ip-of-docker-server>:5000"]
}Then restart docker:
sudo systemctl restart dockerSetup the docker server to host the miner submissions.
Start the server:
source .venv/bin/activate
cd coding/finetune/llm
pm2 start --name llm-server.25000 "gunicorn app:app --workers 5 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:25000 --timeout 800"Ensure that the port 25000 is open on your machine and accessable from the Docker server.
Ensure that ufw is enabled on your machine, after doing so you can restrict the port to only be accessable from the Docker server by running the following commands:
sudo ufw allow from <docker-server-ip> to any port 25000
sudo ufw deny 25000
sudo ufw reloadTest that the port is open by running the following command from the docker server:
curl <validator-ip>:25000The command should return the response: {"detail":"Not Found"}. If it does not, then the port is not open or accessable from the Docker server.
Setup the IP addresses in the .env file like this:
DOCKER_HOST_IP=<docker-server-ip>
HOST_IP=<validator-server-ip>
REMOTE_DOCKER_HOST=tcp://<docker-server-ip>:2375
Setup the LLM auth key in the .env file like this:
LLM_AUTH_KEY=<random auth key>
ulimit -n unlimitedsource .venv/bin/activate
python3 scripts/start_validator.py
--netuid 45
--subtensor.network <finney/local/test>
--neuron.device cuda
--wallet.name <your wallet> # Must be created using the bittensor-cli
--wallet.hotkey <your hotkey> # Must be created using the bittensor-cli
--logging.debug # Run in debug mode, alternatively --logging.trace for trace mode
--axon.port # VERY IMPORTANT: set the port to be one of the open TCP ports on your machine
--wandb.on True # default is true but you can disable