Home

Awesome

This repository allows you to set up a AI Horde Worker to generate or alchemize images for others

AI Horde Worker

Important Note:

Legacy information:

This repo contains the original (now outdated - see above) reference implementation for a AI Horde Worker. This will turn your graphics card(s) into a worker for the AI Horde and you will receive in turn kudos which will give you priority for your own generations.

Alternatively you can become an Alchemist worker which is much more lightweight and can even run on CPU (i.e. without a GPU).

Please note that AMD card are not currently supported, but may be in the future. (Note: horde-worker-reGen has prelimanry support for AMD and if you are an AMD card and would like to help us improve support by testing it, let us know in our discord)

To run the bridge, simply follow the instructions for your own OS

Installing

If you haven't already, go to AI Horde and register an account, then store your API key somewhere secure. You will need it later in these instructions.

This will allow your worker to gather kudos for your account.

Windows

Using git (recommended)

Use these instructions if you have installed git for windows.

This option is recommended as it will make keeping your repository up to date much easier.

  1. Use your start menu to open git GUI
  2. Select "Clone Existing Repository".
  3. In the Source location put https://github.com/Haidra-Org/AI-Horde-Worker.git
  4. In the target directory, browse to any folder you want to put the horde worker folder.
  5. Press Clone
  6. In the new window that opens up, on the top menu, go to Repository > Git Bash. A new terminal window will open.
  7. continue with the Running instructions

Without git

Use these instructions if you do not have git for windows and do not want to install it. These instructions make updating the worker a bit more difficult down the line.

  1. Download the zipped version
  2. Extract it to any folder of your choice
  3. continue with the Running instructions

Linux

This assumes you have git installed

Open a bash terminal and run these commands (just copy-paste them all together)

git clone https://github.com/Haidra-Org/AI-Horde-Worker.git
cd AI-Horde-Worker

Continue with the Running instructions

Running

The below instructions refer to running scripts horde-bridge or update-runtime. Depending on your OS, append .cmd for windows, or .sh for linux.

You can double click the provided script files below from a file explorer or run it from a terminal like bash, git bash or cmd depending on your OS. The latter option will allow you to see errors in case of a crash, so it's recommended.

Update runtime

If you have just installed or updated your worker code run the update-runtime script. This will ensure the dependencies needed for your worker to run are up to date.

For a scribe (i.e text generation), run update-runtime --scribe instead as it has far fewer requirements.

This script can take 10-15 minutes to complete.

Configure

In order to connect to the horde with your username and a good worker name, you need to configure your horde bridge. To this end, we've developed an easy WebUI you can use

To load it, simply run bridge-webui. It will then show you a URL you can open with your browser. Open it and it will allow you to tweak all horde options. Once you press Save Configuration it will create a bridgeData.yaml file with all the options you set.

Fill in at least:

You can use this UI and update your bridge settings even while your worker is running. Your worker should then pick up the new settings within 60 seconds.

You can also edit this file using a text editor. We also provide a bridgeData_template.yaml with comments on each option which you can copy into a new bridgeData.yaml file. This info should soon be onboarded onto the webui as well.

Startup

Start your worker, depending on which type your want.

Remember that worker names have to be different between Stable Diffusion worker and Alchemist worker. If you want to start a different type of worker in the same install directory, ensure a new name by using the --name command line argument.

Running with multiple GPUs

To use multiple GPUs as with NVLINK workers, each has to start their own webui instance. For linux, you just need to limit the run to a specific card:

CUDA_VISIBLE_DEVICES=0 ./horde-bridge.sh -n "My awesome instance #1"
CUDA_VISIBLE_DEVICES=1 ./horde-bridge.sh -n "My awesome instance #2"

etc

Updating

The AI Horde workers are under constant improvement. In case there is more recent code to use follow these steps to update

First step: Shut down your worker by putting it into maintenance, and then pressing ctrl+c

git

Use this approach if you cloned the original repository using git clone

  1. Open a or bash, git bash, cmd, or powershell terminal depending on your OS
  2. Navigate to the folder you have the AI Horde Worker repository installed if you're not already there.
  3. run git pull
  4. continue with Running instructions above

Afterwards run the horde-bridge script for your OS as usual.

zip

Use this approach if you downloaded the git repository as a zip file and extracted it somewhere.

  1. delete the worker/ directory from your folder
  2. Download the repository from github as a zip file
  3. Extract its contents into the same the folder you have the AI Horde Worker repository installed, overwriting any existing files
  4. continue with Running instructions above

Stopping

Model Usage

Many models in this project use the CreativeML OpenRAIL License. Please read the full license here.

Docker

To run the Docker container, specify the required environment variables:

ghcr.io/Haidra-Org/ai-horde-worker:<insert release tag here>

Optional environment variables: