add diagram

pull/2/head
unknown 2023-03-19 11:20:44 -05:00
parent 8eca587825
commit 6614af6f21
No known key found for this signature in database
GPG Key ID: CA376082283AF69A
3 changed files with 36 additions and 44 deletions

View File

@ -1,22 +1,43 @@
# stable-diffusion-webui-distributed # stable-diffusion-webui-distributed
This extension allows one to form a distributed compute system by linking up multiple instances of stable-diffusion-webui to one master instance. In practice, this means being able to tell a bunch of machines to generate images at the same time and have them sent right back to your controlling machine. The main goal is to maximize concurrency and minimize the latency of large-scale image generation in the main sdwui instance. This extension enables you to form a distributed computing system by connecting multiple stable-diffusion-webui instances together.
Pros: The main goal is to maximize concurrency and minimize the latency of large-scale image generation in the main sdwui instance.\
- should be able to enslave any sdwui running in api mode In practice, this means being able to tell a bunch of machines to generate images at the same time and have them sent right back to your controlling machine.
- can be disabled at any time on the main instance just like a normal script
- can be used with sdwui api instances setup to use [HTTPS](https://github.com/papuSpartan/stable-diffusion-webui-auto-tls-https)
- should work with any combination of models, vae, and lora
Cons: ![alt text](doc/sdwui_distributed.drawio.png)\
- currently only suports txt2img *Diagram showing Master/slave architecture of the extension*
- not a low-level implementation. Meaning, it will not "combine" your VRAM and compute a singular huge image as some might conclude at first glance
- currently you are responsible for each remote worker having the models and etc. that you request to use from the master instance
- currently requires a patch (only to the master sdwui instance)
- currently does not predict out of memory exceptions (first on priority)
**Pull requests and bug reports are much appreciated** **Contributions and feedback are much appreciated!**
## How it works (currently) ## Installation
**DISCLAIMER - I do NOT recommend casual users use this yet unless you are okay with the possibility of severe instability**
On the master instance:
- Install the [patch](https://gist.github.com/papuSpartan/e300f5a7030b6179f7e73dd6f75891fb)
- Go to the "Extensions" tab and then swap to the "Install from URL" tab
- Paste https://github.com/papuSpartan/stable-diffusion-webui-distributed.git into "URL for extension's git repository" and click install
- Ensure that you have setup your `COMMANDLINE_ARGS` include the necessary info on your remote machines. Ex:
```
set COMMANDLINE_ARGS=--distributed-remotes laptop:192.168.1.3:7860 argon:fake.local:7860 --distributed-skip-verify-remotes --distributed-remotes-autosave
```
On each slave instance:
- enable the api by passing `--api` and ensure it is listening by using `--listen`
- ensure all of the models, scripts, and whatever else you think you might request from the master is present\
*if you want to sync models and etc. between a huge amount of nodes you might want to use something like rsync or winscp*
# Usage Notes
- If benchmarking fails, just delete the workers.json file generated in the extension folder and try again.
- You need to have all of the workers you plan to use connected when benchmarking for things to work properly (will be fixed later).
#### Command-line arguments
**--distributed-remotes** Enter n pairs of sockets corresponding to remote workers in the form `name:address:port`\
**--distributed-skip-verify-remotes** Disable verification of remote worker TLS certificates (useful for if you are using self-signed certs like with auto tls-https)\
**--distributed-remotes-autosave** Enable auto-saving of remote worker generations
**--distributed-debug** Enable debug information
# How it works
Say you want to generate 12 images and you hit the generate button on the master instance: Say you want to generate 12 images and you hit the generate button on the master instance:
1. If there is no workers.json file, it will benchmark every machine(worker) and save that information to workers.json 1. If there is no workers.json file, it will benchmark every machine(worker) and save that information to workers.json
2. Assume we have 3 workers, with each worker measured to run at ~20ipm. Images will be split equally among them. 2. Assume we have 3 workers, with each worker measured to run at ~20ipm. Images will be split equally among them.
@ -36,33 +57,3 @@ The reason it works like this is the following:
- 'laptop' is the fastest real-time worker at 20 ipm so it (initially) gets dealt an equal share of 4 images - 'laptop' is the fastest real-time worker at 20 ipm so it (initially) gets dealt an equal share of 4 images
- both of the other workers are considered 'complementary' workers because they cannot keep up with 'laptop' **enough*** - both of the other workers are considered 'complementary' workers because they cannot keep up with 'laptop' **enough***
- because of my goal for this extension, both 'complementary' workers will calculate how much, in addition, they **can** make in the time that 'laptop' will take to make the main 12. - because of my goal for this extension, both 'complementary' workers will calculate how much, in addition, they **can** make in the time that 'laptop' will take to make the main 12.
## Installation
**DISCLAIMER - I do NOT recommend casual users use this yet unless you are okay with the possibility of severe instability**
On the master instance:
- install the [necessary patch](https://gist.github.com/papuSpartan/e300f5a7030b6179f7e73dd6f75891fb)
- Go to the "Extensions" tab and then swap to the "Install from URL" tab
- Paste https://github.com/papuSpartan/stable-diffusion-webui-distributed.git into "URL for extension's git repository" and click install
- Ensure that you have setup your `COMMANDLINE_ARGS` include the necessary info on your remote machines. Ex:
```
set COMMANDLINE_ARGS=--distributed-remotes laptop:192.168.1.3:7860 argon:fake.local:7860 --distributed-skip-verify-remotes --distributed-remotes-autosave
```
On each slave instance:
- enable the api by passing `--api` and ensure it is listening by using `--listen`
- ensure all of the models, scripts, and whatever else you think you might request from the master is present\
*if you're wanting to sync a huge amount of nodes you might want to use something like rsync or winscp*
# Usage Notes
- If benchmarking fails, just delete the workers.json file generated in the extension folder and try again.
- You need to have all of the workers you plan to use connected when benchmarking for things to work properly (will be fixed later).
### Command-line arguments
**--distributed-remotes** Enter n pairs of sockets corresponding to remote workers in the form `name:address:port`\
**--distributed-skip-verify-remotes** Disable verification of remote worker TLS certificates (useful for if you are using self-signed certs like with auto tls-https)\
**--distributed-remotes-autosave** Enable auto-saving of remote worker generations
**--distributed-debug** Enable debug information

View File

@ -0,0 +1 @@
<mxfile host="app.diagrams.net" modified="2023-03-19T15:57:45.316Z" agent="5.0 (Windows)" etag="x5uRCBaVFTFaBPpqFItC" version="21.0.8" type="device"><diagram name="Page-1" id="LpnQQc6UBgZ3fWiKt5Bu">5Vldb6M4FP01eWyE7UDgMWk6s7OaGXXUh515GjngEqsGI+M0pL9+7WAngElDO0mz0lZqZR9/wD333GtfOkK3WfVZ4GL1jSeEjaCXVCO0GEEYgkj91cC2BiYwqIFU0KSGvAPwQF9IDQKLrmlCSoPVkOScSVq0wZjnOYllC8NC8E172iNnSQsocEoc4CHGzEX/oYlcGbN874D/RWi6sk8GnhnJsJ1sgHKFE75pQOhuhG4F57JuZdUtYZq7Ni+fjozuX0yQXA5ZsH1K5MuXv6vlrwWb8R8v8kv29cbS/IzZ2lhs3lZuLQU023E0X8mMKQSopoEWNEvVAxldqr8xo8VvLKRq5kRuuHiiuR79RAXZYMZ+AxhW6ndcaHj3UCIkqY6aA/YkKXERnhEptmqKWYAgqpcYYYFgWvc3BzcFxrpVw0MWw0YY6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