Spaces:
Runtime error
Runtime error
update readme
Browse files- README.md +68 -30
- server/config.py +0 -5
README.md
CHANGED
@@ -27,38 +27,39 @@ You need CUDA and Python 3.10, Node > 19, Mac with an M1/M2/M3 chip or Intel Arc
|
|
27 |
```bash
|
28 |
python -m venv venv
|
29 |
source venv/bin/activate
|
30 |
-
pip3 install -r requirements.txt
|
31 |
cd frontend && npm install && npm run build && cd ..
|
32 |
-
|
33 |
-
python run.py --reload --pipeline img2imgSD21Turbo
|
34 |
```
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
don't forget to fuild the frontend first
|
39 |
```bash
|
40 |
cd frontend && npm install && npm run build && cd ..
|
41 |
```
|
42 |
|
|
|
|
|
|
|
|
|
43 |
# LCM
|
44 |
### Image to Image
|
45 |
|
46 |
```bash
|
47 |
-
python
|
48 |
```
|
49 |
|
50 |
# LCM
|
51 |
### Text to Image
|
52 |
|
53 |
```bash
|
54 |
-
python
|
55 |
```
|
56 |
|
57 |
### Image to Image ControlNet Canny
|
58 |
|
59 |
-
|
60 |
```bash
|
61 |
-
python
|
62 |
```
|
63 |
|
64 |
|
@@ -67,39 +68,73 @@ python run.py --reload --pipeline controlnet
|
|
67 |
Using LCM-LoRA, giving it the super power of doing inference in as little as 4 steps. [Learn more here](https://huggingface.co/blog/lcm_lora) or [technical report](https://huggingface.co/papers/2311.05556)
|
68 |
|
69 |
|
70 |
-
|
71 |
### Image to Image ControlNet Canny LoRa
|
72 |
|
73 |
```bash
|
74 |
-
python
|
75 |
```
|
76 |
or SDXL, note that SDXL is slower than SD15 since the inference runs on 1024x1024 images
|
77 |
|
78 |
```bash
|
79 |
-
python
|
80 |
```
|
81 |
|
82 |
### Text to Image
|
83 |
|
84 |
```bash
|
85 |
-
python
|
86 |
```
|
87 |
|
88 |
-
or
|
89 |
-
|
90 |
```bash
|
91 |
-
python
|
92 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
|
95 |
### Setting environment variables
|
96 |
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
If you run using `bash build-run.sh` you can set `PIPELINE` variables to choose the pipeline you want to run
|
105 |
|
@@ -110,14 +145,14 @@ PIPELINE=txt2imgLoraSDXL bash build-run.sh
|
|
110 |
and setting environment variables
|
111 |
|
112 |
```bash
|
113 |
-
TIMEOUT=120 SAFETY_CHECKER=True MAX_QUEUE_SIZE=4 python
|
114 |
```
|
115 |
|
116 |
If you're running locally and want to test it on Mobile Safari, the webserver needs to be served over HTTPS, or follow this instruction on my [comment](https://github.com/radames/Real-Time-Latent-Consistency-Model/issues/17#issuecomment-1811957196)
|
117 |
|
118 |
```bash
|
119 |
openssl req -newkey rsa:4096 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
|
120 |
-
python
|
121 |
```
|
122 |
|
123 |
## Docker
|
@@ -141,15 +176,18 @@ or with environment variables
|
|
141 |
```bash
|
142 |
docker run -ti -e PIPELINE=txt2imgLoraSDXL -p 7860:7860 --gpus all lcm-live
|
143 |
```
|
144 |
-
# Development Mode
|
145 |
-
|
146 |
|
147 |
-
```bash
|
148 |
-
python run.py --reload
|
149 |
-
```
|
150 |
|
151 |
# Demo on Hugging Face
|
152 |
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
https://github.com/radames/Real-Time-Latent-Consistency-Model/assets/102277/c4003ac5-e7ff-44c0-97d3-464bb659de70
|
|
|
27 |
```bash
|
28 |
python -m venv venv
|
29 |
source venv/bin/activate
|
30 |
+
pip3 install -r server/requirements.txt
|
31 |
cd frontend && npm install && npm run build && cd ..
|
32 |
+
python server/main.py --reload --pipeline img2imgSDTurbo
|
|
|
33 |
```
|
34 |
|
35 |
+
Don't forget to fuild the frontend!!!
|
36 |
+
|
|
|
37 |
```bash
|
38 |
cd frontend && npm install && npm run build && cd ..
|
39 |
```
|
40 |
|
41 |
+
# Pipelines
|
42 |
+
You can build your own pipeline following examples here [here](pipelines),
|
43 |
+
|
44 |
+
|
45 |
# LCM
|
46 |
### Image to Image
|
47 |
|
48 |
```bash
|
49 |
+
python server/main.py --reload --pipeline img2img
|
50 |
```
|
51 |
|
52 |
# LCM
|
53 |
### Text to Image
|
54 |
|
55 |
```bash
|
56 |
+
python server/main.py --reload --pipeline txt2img
|
57 |
```
|
58 |
|
59 |
### Image to Image ControlNet Canny
|
60 |
|
|
|
61 |
```bash
|
62 |
+
python server/main.py --reload --pipeline controlnet
|
63 |
```
|
64 |
|
65 |
|
|
|
68 |
Using LCM-LoRA, giving it the super power of doing inference in as little as 4 steps. [Learn more here](https://huggingface.co/blog/lcm_lora) or [technical report](https://huggingface.co/papers/2311.05556)
|
69 |
|
70 |
|
|
|
71 |
### Image to Image ControlNet Canny LoRa
|
72 |
|
73 |
```bash
|
74 |
+
python server/main.py --reload --pipeline controlnetLoraSD15
|
75 |
```
|
76 |
or SDXL, note that SDXL is slower than SD15 since the inference runs on 1024x1024 images
|
77 |
|
78 |
```bash
|
79 |
+
python server/main.py --reload --pipeline controlnetLoraSDXL
|
80 |
```
|
81 |
|
82 |
### Text to Image
|
83 |
|
84 |
```bash
|
85 |
+
python server/main.py --reload --pipeline txt2imgLora
|
86 |
```
|
87 |
|
|
|
|
|
88 |
```bash
|
89 |
+
python server/main.py --reload --pipeline txt2imgLoraSDXL
|
90 |
```
|
91 |
+
# Available Pipelines
|
92 |
+
|
93 |
+
#### [LCM](https://huggingface.co/SimianLuo/LCM_Dreamshaper_v7)
|
94 |
+
|
95 |
+
`img2img`
|
96 |
+
`txt2img`
|
97 |
+
`controlnet`
|
98 |
+
`txt2imgLora`
|
99 |
+
`controlnetLoraSD15`
|
100 |
+
|
101 |
+
#### [SD15](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0)
|
102 |
+
`controlnetLoraSDXL`
|
103 |
+
`txt2imgLoraSDXL`
|
104 |
+
|
105 |
+
#### [SDXL Turbo](https://huggingface.co/stabilityai/sd-xl-turbo)
|
106 |
+
|
107 |
+
`img2imgSDXLTurbo`
|
108 |
+
`controlnetSDXLTurbo`
|
109 |
+
|
110 |
+
|
111 |
+
#### [SDTurbo](https://huggingface.co/stabilityai/sd-turbo)
|
112 |
+
`img2imgSDTurbo`
|
113 |
+
`controlnetSDTurbo`
|
114 |
+
|
115 |
+
#### [Segmind-Vega](https://huggingface.co/segmind/Segmind-Vega)
|
116 |
+
`controlnetSegmindVegaRT`
|
117 |
+
`img2imgSegmindVegaRT`
|
118 |
|
119 |
|
120 |
### Setting environment variables
|
121 |
|
122 |
|
123 |
+
* `--host`: Host address (default: 0.0.0.0)
|
124 |
+
* `--port`: Port number (default: 7860)
|
125 |
+
* `--reload`: Reload code on change
|
126 |
+
* `--max-queue-size`: Maximum queue size (optional)
|
127 |
+
* `--timeout`: Timeout period (optional)
|
128 |
+
* `--safety-checker`: Enable Safety Checker (optional)
|
129 |
+
* `--torch-compile`: Use Torch Compile
|
130 |
+
* `--use-taesd` / `--no-taesd`: Use Tiny Autoencoder
|
131 |
+
* `--pipeline`: Pipeline to use (default: "txt2img")
|
132 |
+
* `--ssl-certfile`: SSL Certificate File (optional)
|
133 |
+
* `--ssl-keyfile`: SSL Key File (optional)
|
134 |
+
* `--debug`: Print Inference time
|
135 |
+
* `--compel`: Compel option
|
136 |
+
* `--sfast`: Enable Stable Fast
|
137 |
+
* `--oneflow`: Enable OneFlow
|
138 |
|
139 |
If you run using `bash build-run.sh` you can set `PIPELINE` variables to choose the pipeline you want to run
|
140 |
|
|
|
145 |
and setting environment variables
|
146 |
|
147 |
```bash
|
148 |
+
TIMEOUT=120 SAFETY_CHECKER=True MAX_QUEUE_SIZE=4 python server/main.py --reload --pipeline txt2imgLoraSDXL
|
149 |
```
|
150 |
|
151 |
If you're running locally and want to test it on Mobile Safari, the webserver needs to be served over HTTPS, or follow this instruction on my [comment](https://github.com/radames/Real-Time-Latent-Consistency-Model/issues/17#issuecomment-1811957196)
|
152 |
|
153 |
```bash
|
154 |
openssl req -newkey rsa:4096 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
|
155 |
+
python server/main.py --reload --ssl-certfile=certificate.pem --ssl-keyfile=key.pem
|
156 |
```
|
157 |
|
158 |
## Docker
|
|
|
176 |
```bash
|
177 |
docker run -ti -e PIPELINE=txt2imgLoraSDXL -p 7860:7860 --gpus all lcm-live
|
178 |
```
|
|
|
|
|
179 |
|
|
|
|
|
|
|
180 |
|
181 |
# Demo on Hugging Face
|
182 |
|
183 |
+
|
184 |
+
* [radames/Real-Time-Latent-Consistency-Model](https://huggingface.co/spaces/radames/Real-Time-Latent-Consistency-Model)
|
185 |
+
* [radames/Real-Time-SD-Turbo](https://huggingface.co/spaces/radames/Real-Time-SD-Turbo)
|
186 |
+
* [latent-consistency/Real-Time-LCM-ControlNet-Lora-SD1.5](https://huggingface.co/spaces/latent-consistency/Real-Time-LCM-ControlNet-Lora-SD1.5)
|
187 |
+
* [latent-consistency/Real-Time-LCM-Text-to-Image-Lora-SD1.5](https://huggingface.co/spaces/latent-consistency/Real-Time-LCM-Text-to-Image-Lora-SD1.5)
|
188 |
+
* [radames/Real-Time-Latent-Consistency-Model-Text-To-Image](https://huggingface.co/spaces/radames/Real-Time-Latent-Consistency-Model-Text-To-Image)
|
189 |
+
|
190 |
+
|
191 |
+
|
192 |
|
193 |
https://github.com/radames/Real-Time-Latent-Consistency-Model/assets/102277/c4003ac5-e7ff-44c0-97d3-464bb659de70
|
server/config.py
CHANGED
@@ -7,7 +7,6 @@ class Args(NamedTuple):
|
|
7 |
host: str
|
8 |
port: int
|
9 |
reload: bool
|
10 |
-
mode: str
|
11 |
max_queue_size: int
|
12 |
timeout: float
|
13 |
safety_checker: bool
|
@@ -35,15 +34,11 @@ TORCH_COMPILE = os.environ.get("TORCH_COMPILE", None) == "True"
|
|
35 |
USE_TAESD = os.environ.get("USE_TAESD", "True") == "True"
|
36 |
default_host = os.getenv("HOST", "0.0.0.0")
|
37 |
default_port = int(os.getenv("PORT", "7860"))
|
38 |
-
default_mode = os.getenv("MODE", "default")
|
39 |
|
40 |
parser = argparse.ArgumentParser(description="Run the app")
|
41 |
parser.add_argument("--host", type=str, default=default_host, help="Host address")
|
42 |
parser.add_argument("--port", type=int, default=default_port, help="Port number")
|
43 |
parser.add_argument("--reload", action="store_true", help="Reload code on change")
|
44 |
-
parser.add_argument(
|
45 |
-
"--mode", type=str, default=default_mode, help="App Inferece Mode: txt2img, img2img"
|
46 |
-
)
|
47 |
parser.add_argument(
|
48 |
"--max-queue-size",
|
49 |
dest="max_queue_size",
|
|
|
7 |
host: str
|
8 |
port: int
|
9 |
reload: bool
|
|
|
10 |
max_queue_size: int
|
11 |
timeout: float
|
12 |
safety_checker: bool
|
|
|
34 |
USE_TAESD = os.environ.get("USE_TAESD", "True") == "True"
|
35 |
default_host = os.getenv("HOST", "0.0.0.0")
|
36 |
default_port = int(os.getenv("PORT", "7860"))
|
|
|
37 |
|
38 |
parser = argparse.ArgumentParser(description="Run the app")
|
39 |
parser.add_argument("--host", type=str, default=default_host, help="Host address")
|
40 |
parser.add_argument("--port", type=int, default=default_port, help="Port number")
|
41 |
parser.add_argument("--reload", action="store_true", help="Reload code on change")
|
|
|
|
|
|
|
42 |
parser.add_argument(
|
43 |
"--max-queue-size",
|
44 |
dest="max_queue_size",
|