Spaces:
Sleeping
Sleeping
better defaults
Browse files- README.md +3 -2
- app.py +1 -1
- config.py +16 -10
- pipelines/controlnelSD21Turbo.py +2 -2
- pipelines/controlnet.py +1 -1
- pipelines/controlnetLoraSD15.py +1 -1
- pipelines/controlnetLoraSDXL.py +1 -1
- pipelines/controlnetSDXLTurbo.py +1 -1
- pipelines/controlnetSegmindVegaRT.py +1 -1
- pipelines/img2img.py +1 -1
- pipelines/img2imgSD21Turbo.py +2 -2
- pipelines/img2imgSDXLTurbo.py +1 -1
- pipelines/img2imgSegmindVegaRT.py +1 -1
- pipelines/txt2img.py +1 -1
- pipelines/txt2imgLora.py +1 -1
- pipelines/txt2imgLoraSDXL.py +1 -1
README.md
CHANGED
@@ -28,8 +28,9 @@ python -m venv venv
|
|
28 |
source venv/bin/activate
|
29 |
pip3 install -r requirements.txt
|
30 |
cd frontend && npm install && npm run build && cd ..
|
31 |
-
|
32 |
-
|
|
|
33 |
|
34 |
# Pipelines
|
35 |
You can build your own pipeline following examples here [here](pipelines),
|
|
|
28 |
source venv/bin/activate
|
29 |
pip3 install -r requirements.txt
|
30 |
cd frontend && npm install && npm run build && cd ..
|
31 |
+
# fastest pipeline
|
32 |
+
python run.py --reload --pipeline img2imgSD21Turbo
|
33 |
+
```
|
34 |
|
35 |
# Pipelines
|
36 |
You can build your own pipeline following examples here [here](pipelines),
|
app.py
CHANGED
@@ -12,7 +12,7 @@ print("TORCH_DTYPE:", torch_dtype)
|
|
12 |
print("PIPELINE:", args.pipeline)
|
13 |
print("SAFETY_CHECKER:", args.safety_checker)
|
14 |
print("TORCH_COMPILE:", args.torch_compile)
|
15 |
-
print("USE_TAESD:", args.
|
16 |
print("COMPEL:", args.compel)
|
17 |
print("DEBUG:", args.debug)
|
18 |
|
|
|
12 |
print("PIPELINE:", args.pipeline)
|
13 |
print("SAFETY_CHECKER:", args.safety_checker)
|
14 |
print("TORCH_COMPILE:", args.torch_compile)
|
15 |
+
print("USE_TAESD:", args.taesd)
|
16 |
print("COMPEL:", args.compel)
|
17 |
print("DEBUG:", args.debug)
|
18 |
|
config.py
CHANGED
@@ -12,7 +12,7 @@ class Args(NamedTuple):
|
|
12 |
timeout: float
|
13 |
safety_checker: bool
|
14 |
torch_compile: bool
|
15 |
-
|
16 |
pipeline: str
|
17 |
ssl_certfile: str
|
18 |
ssl_keyfile: str
|
@@ -24,7 +24,7 @@ MAX_QUEUE_SIZE = int(os.environ.get("MAX_QUEUE_SIZE", 0))
|
|
24 |
TIMEOUT = float(os.environ.get("TIMEOUT", 0))
|
25 |
SAFETY_CHECKER = os.environ.get("SAFETY_CHECKER", None) == "True"
|
26 |
TORCH_COMPILE = os.environ.get("TORCH_COMPILE", None) == "True"
|
27 |
-
USE_TAESD = os.environ.get("USE_TAESD",
|
28 |
default_host = os.getenv("HOST", "0.0.0.0")
|
29 |
default_port = int(os.getenv("PORT", "7860"))
|
30 |
default_mode = os.getenv("MODE", "default")
|
@@ -38,7 +38,7 @@ parser.add_argument(
|
|
38 |
)
|
39 |
parser.add_argument(
|
40 |
"--max-queue-size",
|
41 |
-
"
|
42 |
type=int,
|
43 |
default=MAX_QUEUE_SIZE,
|
44 |
help="Max Queue Size",
|
@@ -46,23 +46,28 @@ parser.add_argument(
|
|
46 |
parser.add_argument("--timeout", type=float, default=TIMEOUT, help="Timeout")
|
47 |
parser.add_argument(
|
48 |
"--safety-checker",
|
49 |
-
"
|
50 |
action="store_true",
|
51 |
default=SAFETY_CHECKER,
|
52 |
help="Safety Checker",
|
53 |
)
|
54 |
parser.add_argument(
|
55 |
"--torch-compile",
|
56 |
-
"
|
57 |
action="store_true",
|
58 |
default=TORCH_COMPILE,
|
59 |
help="Torch Compile",
|
60 |
)
|
61 |
parser.add_argument(
|
62 |
-
"--
|
63 |
-
"
|
64 |
action="store_true",
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
66 |
help="Use Tiny Autoencoder",
|
67 |
)
|
68 |
parser.add_argument(
|
@@ -73,14 +78,14 @@ parser.add_argument(
|
|
73 |
)
|
74 |
parser.add_argument(
|
75 |
"--ssl-certfile",
|
76 |
-
"
|
77 |
type=str,
|
78 |
default=None,
|
79 |
help="SSL certfile",
|
80 |
)
|
81 |
parser.add_argument(
|
82 |
"--ssl-keyfile",
|
83 |
-
"
|
84 |
type=str,
|
85 |
default=None,
|
86 |
help="SSL keyfile",
|
@@ -97,5 +102,6 @@ parser.add_argument(
|
|
97 |
default=False,
|
98 |
help="Compel",
|
99 |
)
|
|
|
100 |
|
101 |
args = Args(**vars(parser.parse_args()))
|
|
|
12 |
timeout: float
|
13 |
safety_checker: bool
|
14 |
torch_compile: bool
|
15 |
+
taesd: bool
|
16 |
pipeline: str
|
17 |
ssl_certfile: str
|
18 |
ssl_keyfile: str
|
|
|
24 |
TIMEOUT = float(os.environ.get("TIMEOUT", 0))
|
25 |
SAFETY_CHECKER = os.environ.get("SAFETY_CHECKER", None) == "True"
|
26 |
TORCH_COMPILE = os.environ.get("TORCH_COMPILE", None) == "True"
|
27 |
+
USE_TAESD = os.environ.get("USE_TAESD", "True") == "True"
|
28 |
default_host = os.getenv("HOST", "0.0.0.0")
|
29 |
default_port = int(os.getenv("PORT", "7860"))
|
30 |
default_mode = os.getenv("MODE", "default")
|
|
|
38 |
)
|
39 |
parser.add_argument(
|
40 |
"--max-queue-size",
|
41 |
+
dest="max_queue_size",
|
42 |
type=int,
|
43 |
default=MAX_QUEUE_SIZE,
|
44 |
help="Max Queue Size",
|
|
|
46 |
parser.add_argument("--timeout", type=float, default=TIMEOUT, help="Timeout")
|
47 |
parser.add_argument(
|
48 |
"--safety-checker",
|
49 |
+
dest="safety_checker",
|
50 |
action="store_true",
|
51 |
default=SAFETY_CHECKER,
|
52 |
help="Safety Checker",
|
53 |
)
|
54 |
parser.add_argument(
|
55 |
"--torch-compile",
|
56 |
+
dest="torch_compile",
|
57 |
action="store_true",
|
58 |
default=TORCH_COMPILE,
|
59 |
help="Torch Compile",
|
60 |
)
|
61 |
parser.add_argument(
|
62 |
+
"--taesd",
|
63 |
+
dest="taesd",
|
64 |
action="store_true",
|
65 |
+
help="Use Tiny Autoencoder",
|
66 |
+
)
|
67 |
+
parser.add_argument(
|
68 |
+
"--no-taesd",
|
69 |
+
dest="taesd",
|
70 |
+
action="store_false",
|
71 |
help="Use Tiny Autoencoder",
|
72 |
)
|
73 |
parser.add_argument(
|
|
|
78 |
)
|
79 |
parser.add_argument(
|
80 |
"--ssl-certfile",
|
81 |
+
dest="ssl_certfile",
|
82 |
type=str,
|
83 |
default=None,
|
84 |
help="SSL certfile",
|
85 |
)
|
86 |
parser.add_argument(
|
87 |
"--ssl-keyfile",
|
88 |
+
dest="ssl_keyfile",
|
89 |
type=str,
|
90 |
default=None,
|
91 |
help="SSL keyfile",
|
|
|
102 |
default=False,
|
103 |
help="Compel",
|
104 |
)
|
105 |
+
parser.set_defaults(taesd=USE_TAESD)
|
106 |
|
107 |
args = Args(**vars(parser.parse_args()))
|
pipelines/controlnelSD21Turbo.py
CHANGED
@@ -176,7 +176,7 @@ class Pipeline:
|
|
176 |
safety_checker=None,
|
177 |
)
|
178 |
|
179 |
-
if args.
|
180 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
181 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
182 |
).to(device)
|
@@ -196,7 +196,7 @@ class Pipeline:
|
|
196 |
text_encoder=self.pipe.text_encoder,
|
197 |
truncate_long_prompts=True,
|
198 |
)
|
199 |
-
if args.
|
200 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
201 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
202 |
).to(device)
|
|
|
176 |
safety_checker=None,
|
177 |
)
|
178 |
|
179 |
+
if args.taesd:
|
180 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
181 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
182 |
).to(device)
|
|
|
196 |
text_encoder=self.pipe.text_encoder,
|
197 |
truncate_long_prompts=True,
|
198 |
)
|
199 |
+
if args.taesd:
|
200 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
201 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
202 |
).to(device)
|
pipelines/controlnet.py
CHANGED
@@ -169,7 +169,7 @@ class Pipeline:
|
|
169 |
safety_checker=None,
|
170 |
controlnet=controlnet_canny,
|
171 |
)
|
172 |
-
if args.
|
173 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
174 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
175 |
).to(device)
|
|
|
169 |
safety_checker=None,
|
170 |
controlnet=controlnet_canny,
|
171 |
)
|
172 |
+
if args.taesd:
|
173 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
174 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
175 |
).to(device)
|
pipelines/controlnetLoraSD15.py
CHANGED
@@ -202,7 +202,7 @@ class Pipeline:
|
|
202 |
if psutil.virtual_memory().total < 64 * 1024**3:
|
203 |
pipe.enable_attention_slicing()
|
204 |
|
205 |
-
if args.
|
206 |
pipe.vae = AutoencoderTiny.from_pretrained(
|
207 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
208 |
).to(device)
|
|
|
202 |
if psutil.virtual_memory().total < 64 * 1024**3:
|
203 |
pipe.enable_attention_slicing()
|
204 |
|
205 |
+
if args.taesd:
|
206 |
pipe.vae = AutoencoderTiny.from_pretrained(
|
207 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
208 |
).to(device)
|
pipelines/controlnetLoraSDXL.py
CHANGED
@@ -211,7 +211,7 @@ class Pipeline:
|
|
211 |
returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
|
212 |
requires_pooled=[False, True],
|
213 |
)
|
214 |
-
if args.
|
215 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
216 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
217 |
).to(device)
|
|
|
211 |
returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
|
212 |
requires_pooled=[False, True],
|
213 |
)
|
214 |
+
if args.taesd:
|
215 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
216 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
217 |
).to(device)
|
pipelines/controlnetSDXLTurbo.py
CHANGED
@@ -199,7 +199,7 @@ class Pipeline:
|
|
199 |
returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
|
200 |
requires_pooled=[False, True],
|
201 |
)
|
202 |
-
if args.
|
203 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
204 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
205 |
).to(device)
|
|
|
199 |
returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
|
200 |
requires_pooled=[False, True],
|
201 |
)
|
202 |
+
if args.taesd:
|
203 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
204 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
205 |
).to(device)
|
pipelines/controlnetSegmindVegaRT.py
CHANGED
@@ -208,7 +208,7 @@ class Pipeline:
|
|
208 |
returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
|
209 |
requires_pooled=[False, True],
|
210 |
)
|
211 |
-
if args.
|
212 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
213 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
214 |
).to(device)
|
|
|
208 |
returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
|
209 |
requires_pooled=[False, True],
|
210 |
)
|
211 |
+
if args.taesd:
|
212 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
213 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
214 |
).to(device)
|
pipelines/img2img.py
CHANGED
@@ -102,7 +102,7 @@ class Pipeline:
|
|
102 |
base_model,
|
103 |
safety_checker=None,
|
104 |
)
|
105 |
-
if args.
|
106 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
107 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
108 |
).to(device)
|
|
|
102 |
base_model,
|
103 |
safety_checker=None,
|
104 |
)
|
105 |
+
if args.taesd:
|
106 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
107 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
108 |
).to(device)
|
pipelines/img2imgSD21Turbo.py
CHANGED
@@ -99,7 +99,7 @@ class Pipeline:
|
|
99 |
base_model,
|
100 |
safety_checker=None,
|
101 |
)
|
102 |
-
if args.
|
103 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
104 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
105 |
).to(device)
|
@@ -158,7 +158,7 @@ class Pipeline:
|
|
158 |
generator=generator,
|
159 |
strength=strength,
|
160 |
num_inference_steps=steps,
|
161 |
-
guidance_scale=1.
|
162 |
width=params.width,
|
163 |
height=params.height,
|
164 |
output_type="pil",
|
|
|
99 |
base_model,
|
100 |
safety_checker=None,
|
101 |
)
|
102 |
+
if args.taesd:
|
103 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
104 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
105 |
).to(device)
|
|
|
158 |
generator=generator,
|
159 |
strength=strength,
|
160 |
num_inference_steps=steps,
|
161 |
+
guidance_scale=1.1,
|
162 |
width=params.width,
|
163 |
height=params.height,
|
164 |
output_type="pil",
|
pipelines/img2imgSDXLTurbo.py
CHANGED
@@ -110,7 +110,7 @@ class Pipeline:
|
|
110 |
base_model,
|
111 |
safety_checker=None,
|
112 |
)
|
113 |
-
if args.
|
114 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
115 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
116 |
).to(device)
|
|
|
110 |
base_model,
|
111 |
safety_checker=None,
|
112 |
)
|
113 |
+
if args.taesd:
|
114 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
115 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
116 |
).to(device)
|
pipelines/img2imgSegmindVegaRT.py
CHANGED
@@ -116,7 +116,7 @@ class Pipeline:
|
|
116 |
safety_checker=None,
|
117 |
variant="fp16",
|
118 |
)
|
119 |
-
if args.
|
120 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
121 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
122 |
).to(device)
|
|
|
116 |
safety_checker=None,
|
117 |
variant="fp16",
|
118 |
)
|
119 |
+
if args.taesd:
|
120 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
121 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
122 |
).to(device)
|
pipelines/txt2img.py
CHANGED
@@ -85,7 +85,7 @@ class Pipeline:
|
|
85 |
self.pipe = DiffusionPipeline.from_pretrained(
|
86 |
base_model, safety_checker=None
|
87 |
)
|
88 |
-
if args.
|
89 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
90 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
91 |
).to(device)
|
|
|
85 |
self.pipe = DiffusionPipeline.from_pretrained(
|
86 |
base_model, safety_checker=None
|
87 |
)
|
88 |
+
if args.taesd:
|
89 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
90 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
91 |
).to(device)
|
pipelines/txt2imgLora.py
CHANGED
@@ -92,7 +92,7 @@ class Pipeline:
|
|
92 |
self.pipe = DiffusionPipeline.from_pretrained(
|
93 |
base_model, safety_checker=None
|
94 |
)
|
95 |
-
if args.
|
96 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
97 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
98 |
).to(device)
|
|
|
92 |
self.pipe = DiffusionPipeline.from_pretrained(
|
93 |
base_model, safety_checker=None
|
94 |
)
|
95 |
+
if args.taesd:
|
96 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
97 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
98 |
).to(device)
|
pipelines/txt2imgLoraSDXL.py
CHANGED
@@ -123,7 +123,7 @@ class Pipeline:
|
|
123 |
returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
|
124 |
requires_pooled=[False, True],
|
125 |
)
|
126 |
-
if args.
|
127 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
128 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
129 |
).to(device)
|
|
|
123 |
returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED,
|
124 |
requires_pooled=[False, True],
|
125 |
)
|
126 |
+
if args.taesd:
|
127 |
self.pipe.vae = AutoencoderTiny.from_pretrained(
|
128 |
taesd_model, torch_dtype=torch_dtype, use_safetensors=True
|
129 |
).to(device)
|