Coder Social home page Coder Social logo

huo-ju / dfserver Goto Github PK

View Code? Open in Web Editor NEW
343.0 9.0 31.0 3.59 MB

A distributed backend AI pipeline server

License: MIT License

Go 50.94% Makefile 0.44% Python 47.92% Shell 0.14% Dockerfile 0.56%
ai-art ai-pipeline pipeline stable-diffusion diffusers

dfserver's Introduction

dfserver

DFserver is an open-sourced distributed backend AI pipeline server for building self-hosted distributed GPU cluster to run the Stable Diffusion and various AI image or prompt building model, but also has a potential to expend large-scale production service, and etc.

Give us a star and your valuable feedback :)

news

Try Stable Diffusion 2 experimental worker: SD2.md

DFserver_small.mp4

The service can uses idle fancy GPUs shared by your friends to build a GPU cluster for running various AI models or just be deployed on your own computer. In the future we will support counting and distributing possible revenue based on the workload of each GPU (Worker).

I have a beautiful vision for DFserver, which can be an enterprise-level service application that can flexibly extend the pipeline to connect models for different tasks in the AI image generation workflow, such as DeepL for supporting multi language prompt input, or Gobig by DD for filling more rendering details while upscale, etc.

Will soon support the generation of multiple images with a single command, and functions related to init-image.

Tasks currently supported in DFserver Pipeline server

  • AI image generator: Stable Diffusion 1.4 (with negative prompt) and Waifu Diffusion 1.3
  • Image Upscaling (Default realesrgan-x4plus model)
  • Guess prompt from an image (CLIP Interrogator)
  • Prompt Build Assist (finetuned from a GPT Neo2.7B model by using 200K prompts selected and preprocessed from krea-ai open-prompts. Model download: https://huggingface.co/huoju/gptneoforsdprompt)

demoimg1

demoimg2

prompt builder

waifu

System Topology

Architecture

Task Sequence Diagram

Getting Start

Server Prerequisites

Worker Prerequisites

Build the dfserver

Requirements:

$ git clone "https://github.com/huo-ju/dfserver.git"
$ cd dfserver
$ make linux-amd64 #or make linux-arm64

dfserver Configuration

cp configs/config.toml.sample configs/config.toml

Edit the config.toml, setup the username/password/host address/port of the rabbitmq.

The default configuration was defined ONE task queue for stable diffusion ai worker (name is ai.sd14), ONE discord bot service, ONE process worker for discord(name is discord.server1)

Run dfserver

./dist/linux_amd64/dfserver --confpath=./configs

or via docker-compose (so you don't need to install RabbitMQ particularly):

docker compose up -d

PS: You still need to set a user in RabbitMQ for ai worker after docker-compose starting up.

AI Worker Install

Copy the pyworker dir to the GPU server, and install all diffusers dependencies(nvidia drivers, CUDA, pytorch, models etc...).

cd pyworker
pip install -r requirements.txt

AI Worker Configuration

cp configs/sd14mega_config.ini.sample configs/sd14mega_config.ini 
#or
cp configs/realesrgan_config.ini.sample configs/realesrgan_config.ini
#or
cp configs/clipinterrogator_config.ini.sample configs/clipinterrogator_config.ini

Edit the config.ini, setup the username/password/host address/port of the rabbitmq.

Run the ai worker

python worker.py sd14mega #stable-diffusion worker with community SD Mega pipeline
#or
python worker.py realesrgan #realesrgan upscaling worker
#or
python worker.py clipinterrogator # clip-interrogator worker

Usage

Add the discord bot to your disord server, and input your prompt.

Example:

!dream Cute sticker design of a AI image generator robotic pipeline service, app icon, trending on appstore, trending on pixiv, hyper-detailed, sharp

with negative prompt (diffuser >= v0.4.0):

!dream Bouquet of Roses |red rose :-1|

The ai task will be collected from user input by discord bot, and published to the rabbitmq, then the task will be fetched by ai worker (running on GPU servers).

The result (generated images) will be published back to the rabbitmq, fetched by process worker (discord.server1), and sent back to the user.

Run the dfserver and aiworker on boot, please see the systemd scripts in deployments

TODO

  • โœ”๏ธ Response error messages to users
  • โœ”๏ธ More AI workers, eg: upscale worker
  • [] Multi GPUs worker support
  • โœ”๏ธ Initial image
  • [] Mask/Inpaint

Credits

dfserver's People

Contributors

huo-ju avatar tymon42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dfserver's Issues

Multi GPU worker

Hello,

I'm interested in contributing to this repo to enable multiGPU workers. I have a machine that I can use to test. Please let me know what I can to do help move the process forward. Thanks

Missing "sd14mega" sample config file

The docs mention a sd14mega sample config, but it appears to be missing from the configs directory. Also didn't see it in any of the other branches.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.