Sign inSign up

fiatrete/sdcn-server

By fiatrete

โ€ขUpdated over 3 years ago

Image
0

255

fiatrete/sdcn-server repository overview

SDCN logo

License PRs Welcome GitHub Contributors Last Commit

Websiteโ  | Playgroundโ  | API Docsโ 

โ Overview

SDCNโ  is an infrastructure for sharing Stable Diffusion computing power

  • Decentralization: By running the SDCN node program, users can register their idle computing resources with the SDCN network
  • Trustlessness: SDCN abstracts the capabilities of Stable Diffusion into a set of atomic interface calls and hides the computing process from application developers
  • Powerful: Application developers can quickly develop their own applications based on the Stable Diffusion related capabilities provided by SDCN, without worrying about how these interfaces are implemented or how computing power is provided

SDCN structure

  • SDCN Node
    • Executes image generation tasks
    • Use Stable Diffusion WebUI with API mode directly
  • SDCN Server
    • Manage and route image generation tasks to SDCN Nodes
    • Hide the image generating details and expose a standard interface to application developers
    • Implement SDCN server with openresty
  • API
    • txt2img
    • img2img
    • integrate
    • more APIs under developing

Why SDCN?

  • Everyone should have the ability to use AI freely, AI will be a public good
  • For the public, the cost of trying various ways of stable diffusion is too high
    • It's difficult to set up a stable diffusion runtime environment on your own
    • Computer performance may not support it
    • Downloading code from GitHub and running Stable Diffusion WebUI is beyond the ability of most non-programmers(even programmers)
    • Learning about models and prompt knowledge requires high learning costs
  • More application developers should be supported in popularizing AI capabilities to the public
  • For application developers, the cost of building a publicly available image generation service is too high
    • Application developers should focus on implementing business requirements
  • The utilization of GPU computing power for home and cloud procurement is very low, leading to significant wastage

โ Getting Started

Try out SDCN functionalities in SDCN websiteโ .

๐ŸŽˆFeel free to file tickets for bugs or feature requests.


โ ๐Ÿ“ฑ How-to: try out SDCN API

SDCN provide SaaS-like API from https://api.sdcn.infoโ 

โ Using sdcn_run.py script

Try the sample code in example folder.

You can modify the example/params-xxx.json to experiment with different parameter combinations.

python3 sdcn_run.py txt2img params-txt2img.json OUTPUT_IMAGE.png
python3 sdcn_run.py img2img params-img2img.json ORIGINAL_IMAGE.png OUTPUT_IMAGE.png
โ Using curl
  1. Install curl and jq
brew install curl jq
  1. Enter example folder and execute
cd example
cat params-txt2img.json \
| curl --location --request POST 'https://api.sdcn.info/txt2img' \
--header 'Content-Type: application/json' -d @- \
| jq '.images[0]' |tr -d '\"' | tr -d '\\' | base64 -d > out.png

๐Ÿ‘‰ SDCN API refer to API Docsโ 


โ ๐ŸŒ How-to: contribute computing power to sdcn.info

  1. Register a donor account on sdcn.infoโ 
  2. Install lastest Stable Diffusion WebUIโ  on your PC or Server
  3. Install the following models & loras::
  1. Startup Stable Diffusion WebUI with --listen --api --share argument
bash webui.sh --listen --api --share

You will get a public URL like https://f00bfa54-7b3c-476b.gradio.live

  1. Login donor account on sdcn.infoโ  and register the public URL to global node list

โ ๐Ÿ”จ How-to: run sdcn-server locally in Docker

  1. Install lastest Stable Diffusion WebUIโ  and Dockerโ  on your PC or Server

  2. Install the following models & loras:

  1. Startup Stable Diffusion WebUI with --listen --api argument
bash webui.sh --listen --api
  1. Start sdcn-server locally in docker with Docker Composeโ :
docker-compose up -d 

Now your sdcn-server is available on "http://127.0.0.1:8080โ "

  1. Register your Stable Diffusion WebUI instance as a SDCN node:
  • Login your account using SDCN's web page;
  • Navigate to Nodes -> Donate Node
  • Enter your worker node's address
  • Click Donate

โš ๏ธ Please note that you must use non-loopback IP address! You cannot use 127.0.0.1 or 'localhost' since our docker container's hostnet is not enabled.

  1. Config SERVICE_PREFIX in example/sdcn_run.py to "http://127.0.0.1:8080โ ".
SERVICE_PREFIX = 'http://127.0.0.1:8080'
  1. Execute the example with your local sdcn-server:
python3 sdcn_run.py txt2img params-txt2img.json OUTPUT_IMAGE.png

โ Roadmap

  • Rename project to DAN
  • Management GUI for computing power donors
    • Add login to the SDCN website
    • CRUD management of computing power provided by donors
  • Workload ranking page
    • Node-based workload ranking
    • Donor-based workload ranking
    • Model-based workload ranking
    • API-based workload ranking
  • Basic SDCN functional interfaces
    • Scale interface
    • Inpaint interface
    • Support for controlnet
  • Enrich examples in the playground
    • 2D to 3D style conversion
    • 3D to 2D style conversion
  • One-click installation of Stable Diffusion WebUI as an SDCN node (Windows & Linux supported)
    • Customize Stable Diffusion WebUI installer
    • Automatically download necessary model files
    • Customize SDCN node daemon as intermediary for communication between Stable Diffusion WebUI and SDCN server
  • Image Stream (user generated by the SDCN tool and share to sdcn.info)
    • Sharing mechanisms for images generated through API or playground
    • A page to display shared images in a waterfall flow
  • Constraints for the use of computing resources
    • APP-Key mechanism
  • Task scheduling mechanism
    • Schedule to nodes with required models already loaded
    • Global load balancing

โ License

This project is licensed under the MIT licenseโ 


โ Credits

Tag summary

Content type

Image

Digest

sha256:c214760c8โ€ฆ

Size

217.6 MB

Last updated

over 3 years ago

docker pull fiatrete/sdcn-server