Spaces:
Running
on
Zero
Running
on
Zero
Remove styles
Browse files- DOCS.md +2 -15
- README.md +1 -2
- app.py +1 -12
- data/styles.json +0 -141
- lib/config.py +0 -1
- lib/inference.py +3 -31
DOCS.md
CHANGED
@@ -6,19 +6,12 @@ TL;DR: Enter a prompt or roll the `🎲` and press `Generate`.
|
|
6 |
|
7 |
Positive and negative prompts are embedded by [Compel](https://github.com/damian0815/compel) for weighting. See [syntax features](https://github.com/damian0815/compel/blob/main/doc/syntax.md) to learn more.
|
8 |
|
|
|
|
|
9 |
Use `+` or `-` to increase the weight of a token. The weight grows exponentially when chained. For example, `blue+` means 1.1x more attention is given to `blue`, while `blue++` means 1.1^2 more, and so on. The same applies to `-`.
|
10 |
|
11 |
Groups of tokens can be weighted together by wrapping in parentheses and multiplying by a float between 0 and 2. For example, `(masterpiece, best quality)1.2` will increase the weight of both `masterpiece` and `best quality` by 1.2x.
|
12 |
|
13 |
-
This is the same syntax used in [InvokeAI](https://invoke-ai.github.io/InvokeAI/features/PROMPTS/) and it differs from [A1111](https://github.com/AUTOMATIC1111/stable-diffusion-webui):
|
14 |
-
|
15 |
-
| Compel | A1111 |
|
16 |
-
| ----------- | ------------- |
|
17 |
-
| `blue++` | `((blue))` |
|
18 |
-
| `blue--` | `[[blue]]` |
|
19 |
-
| `(blue)1.2` | `(blue:1.2)` |
|
20 |
-
| `(blue)0.8` | `(blue:0.8)` |
|
21 |
-
|
22 |
### Models
|
23 |
|
24 |
Some require specific parameters to get the best results, so check the model's link for more information:
|
@@ -32,12 +25,6 @@ Some require specific parameters to get the best results, so check the model's l
|
|
32 |
* [XpucT/Deliberate_v6](https://huggingface.co/XpucT/Deliberate)
|
33 |
* [XpucT/Reliberate_v3](https://huggingface.co/XpucT/Reliberate)
|
34 |
|
35 |
-
### Styles
|
36 |
-
|
37 |
-
[Styles](https://huggingface.co/spaces/adamelliotfields/diffusion/blob/main/data/styles.json) are prompt templates that wrap your positive and negative prompts. Inspired by [twri/sdxl_prompt_styler](https://github.com/twri/sdxl_prompt_styler).
|
38 |
-
|
39 |
-
> 💡 When using syles, start with a simple prompt like `portrait of a cat` or `landscape of a mountain range`.
|
40 |
-
|
41 |
### Scale
|
42 |
|
43 |
Rescale up to 4x using [Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN) with weights from [ai-forever](ai-forever/Real-ESRGAN). Necessary for high-resolution images.
|
|
|
6 |
|
7 |
Positive and negative prompts are embedded by [Compel](https://github.com/damian0815/compel) for weighting. See [syntax features](https://github.com/damian0815/compel/blob/main/doc/syntax.md) to learn more.
|
8 |
|
9 |
+
#### Weighting
|
10 |
+
|
11 |
Use `+` or `-` to increase the weight of a token. The weight grows exponentially when chained. For example, `blue+` means 1.1x more attention is given to `blue`, while `blue++` means 1.1^2 more, and so on. The same applies to `-`.
|
12 |
|
13 |
Groups of tokens can be weighted together by wrapping in parentheses and multiplying by a float between 0 and 2. For example, `(masterpiece, best quality)1.2` will increase the weight of both `masterpiece` and `best quality` by 1.2x.
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
### Models
|
16 |
|
17 |
Some require specific parameters to get the best results, so check the model's link for more information:
|
|
|
25 |
* [XpucT/Deliberate_v6](https://huggingface.co/XpucT/Deliberate)
|
26 |
* [XpucT/Reliberate_v3](https://huggingface.co/XpucT/Reliberate)
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
### Scale
|
29 |
|
30 |
Rescale up to 4x using [Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN) with weights from [ai-forever](ai-forever/Real-ESRGAN). Necessary for high-resolution images.
|
README.md
CHANGED
@@ -62,8 +62,7 @@ preload_from_hub: # up to 10
|
|
62 |
Gradio app for Stable Diffusion 1.5 featuring:
|
63 |
* txt2img and img2img pipelines with IP-Adapter
|
64 |
* ControlNet with Canny edge detection (more preprocessors coming soon)
|
65 |
-
* Compel prompt weighting
|
66 |
-
* Hand-written style templates
|
67 |
* Multiple samplers with Karras scheduling
|
68 |
* DeepCache available
|
69 |
* Real-ESRGAN upscaling
|
|
|
62 |
Gradio app for Stable Diffusion 1.5 featuring:
|
63 |
* txt2img and img2img pipelines with IP-Adapter
|
64 |
* ControlNet with Canny edge detection (more preprocessors coming soon)
|
65 |
+
* Compel prompt weighting and blending
|
|
|
66 |
* Multiple samplers with Karras scheduling
|
67 |
* DeepCache available
|
68 |
* Real-ESRGAN upscaling
|
app.py
CHANGED
@@ -184,19 +184,9 @@ with gr.Blocks(
|
|
184 |
with gr.Row():
|
185 |
negative_prompt = gr.Textbox(
|
186 |
label="Negative Prompt",
|
187 |
-
value="nsfw
|
188 |
-
min_width=320,
|
189 |
lines=1,
|
190 |
)
|
191 |
-
styles = json.loads(read_file("data/styles.json"))
|
192 |
-
style_ids = list(styles.keys())
|
193 |
-
style_ids = [sid for sid in style_ids if not sid.startswith("_")]
|
194 |
-
style = gr.Dropdown(
|
195 |
-
min_width=320,
|
196 |
-
value=Config.STYLE,
|
197 |
-
label="Style Template",
|
198 |
-
choices=[("None", "none")] + [(styles[sid]["name"], sid) for sid in style_ids],
|
199 |
-
)
|
200 |
|
201 |
# Model settings
|
202 |
gr.HTML("<h3>Model</h3>")
|
@@ -430,7 +420,6 @@ with gr.Blocks(
|
|
430 |
image_prompt,
|
431 |
control_image_prompt,
|
432 |
ip_image_prompt,
|
433 |
-
style,
|
434 |
seed,
|
435 |
model,
|
436 |
scheduler,
|
|
|
184 |
with gr.Row():
|
185 |
negative_prompt = gr.Textbox(
|
186 |
label="Negative Prompt",
|
187 |
+
value="nsfw",
|
|
|
188 |
lines=1,
|
189 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
# Model settings
|
192 |
gr.HTML("<h3>Model</h3>")
|
|
|
420 |
image_prompt,
|
421 |
control_image_prompt,
|
422 |
ip_image_prompt,
|
|
|
423 |
seed,
|
424 |
model,
|
425 |
scheduler,
|
data/styles.json
DELETED
@@ -1,141 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"_base": {
|
3 |
-
"positive": "good, perfect, accurate, precise, professional, highly detailed, best quality, masterpiece",
|
4 |
-
"negative": "watermark, trademark, signature, autograph, artifacts, deformed, mutated, bad, ugly, unattractive, noisy, grainy, blurry, distorted, oversaturated, undersaturated, overexposed, underexposed, amateur, sloppy, cluttered, low detail, worst quality"
|
5 |
-
},
|
6 |
-
"abstract": {
|
7 |
-
"name": "Abstract",
|
8 |
-
"positive": "({prompt}), in an abstract art style, non-representational colors and shapes, expressive, imaginative, vibrant, {_base}",
|
9 |
-
"negative": "({prompt}), discrete, objective, realism, photographic, monochrome, muted, {_base}"
|
10 |
-
},
|
11 |
-
"anime_anything": {
|
12 |
-
"name": "Anime: Anything",
|
13 |
-
"positive": "({prompt}), masterpiece, best quality, illustration, beautiful detailed, finely detailed, dramatic light, intricate details",
|
14 |
-
"negative": "({prompt}), lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry"
|
15 |
-
},
|
16 |
-
"anime_josei": {
|
17 |
-
"name": "Anime: Josei",
|
18 |
-
"positive": "({prompt}), in a josei anime style, inspired by Paradise Kiss, by Ai Yazawa, manga, mature, emotional, sophisticated, soft colors, refined lines, {_base}",
|
19 |
-
"negative": "({prompt}), shonen, shoujo, seinen, dark, gritty, realism, photographic, {_base}"
|
20 |
-
},
|
21 |
-
"anime_seinen": {
|
22 |
-
"name": "Anime: Seinen",
|
23 |
-
"positive": "({prompt}), in a seinen anime style, inspired by Ghost in the Shell, by Masamune Shirow, manga, adult, mature, dark, gritty, intricate design, dramatic lighting, high contrast, {_base}",
|
24 |
-
"negative": "({prompt}), shonen, shoujo, josei, realism, photographic, dull, plain, low contrast, {_base}"
|
25 |
-
},
|
26 |
-
"anime_shojo": {
|
27 |
-
"name": "Anime: Shoujo",
|
28 |
-
"positive": "({prompt}), in a shoujo anime style, manga, romantic, emotional, pastel colors, soft lines, {_base}",
|
29 |
-
"negative": "({prompt}), shonen, seinen, josei, dark, gritty, realism, photographic, {_base}"
|
30 |
-
},
|
31 |
-
"anime_shonen": {
|
32 |
-
"name": "Anime: Shonen",
|
33 |
-
"positive": "({prompt}), in a shonen anime style, manga, action, adventure, heroic, youthful, vibrant, high contrast, {_base}",
|
34 |
-
"negative": "({prompt}), shoujo, seinen, josei, realism, photographic, dull, plain, monochrome, muted, low contrast, {_base}"
|
35 |
-
},
|
36 |
-
"art_deco": {
|
37 |
-
"name": "Art Deco",
|
38 |
-
"positive": "({prompt}), in an art deco style, inspired by Tamara de Lempicka, geometric shapes, bold colors, luxurious, elegant, sleek, streamlined, symmetrical, vibrant, high contrast, {_base}",
|
39 |
-
"negative": "({prompt}), realism, photographic, asymmetrical, monochrome, muted, low contrast, {_base}"
|
40 |
-
},
|
41 |
-
"biomechanical": {
|
42 |
-
"name": "Biomechanical",
|
43 |
-
"positive": "({prompt}), in a biomechanical style, organic and mechanical, flesh and metal, cyborg, cybernetic, intricate design, futuristic, sci-fi, {_base}",
|
44 |
-
"negative": "({prompt}), natural, rustic, primitive, medieval, {_base}"
|
45 |
-
},
|
46 |
-
"cubism": {
|
47 |
-
"name": "Cubism",
|
48 |
-
"positive": "({prompt}), in a cubist style, inspired by Picasso, fragmented shapes and planes, abstract forms, collage, {_base}",
|
49 |
-
"negative": "({prompt}), discrete, objective, {_base}"
|
50 |
-
},
|
51 |
-
"cyberpunk": {
|
52 |
-
"name": "Cyberpunk",
|
53 |
-
"positive": "({prompt}), in a cyberpunk style, 2077, synthwave, neon, digital, high-tech, futuristic, dystopian, vibrant, high contrast, {_base}",
|
54 |
-
"negative": "({prompt}), rustic, primitive, medieval, monochrome, muted, low contrast, {_base}"
|
55 |
-
},
|
56 |
-
"enhance": {
|
57 |
-
"name": "Enhance",
|
58 |
-
"positive": "({prompt}), {_base}",
|
59 |
-
"negative": "({prompt}), {_base}"
|
60 |
-
},
|
61 |
-
"expressionism": {
|
62 |
-
"name": "Expressionism",
|
63 |
-
"positive": "({prompt}), in an expressionist style, energetic brushwork, bold colors, abstract forms, vibrant, expressive, imaginative, high contrast, {_base}",
|
64 |
-
"negative": "({prompt}), discrete, objective, realism, photographic, dull, plain, monochrome, muted, low contrast, {_base}"
|
65 |
-
},
|
66 |
-
"fantasy": {
|
67 |
-
"name": "Fantasy",
|
68 |
-
"positive": "({prompt}), in a fantasy style, digital concept art, by Greg Rutkowski, trending on ArtStation, magical, enchanting, ethereal, dreamlike, graphic, illustration, high contrast, {_base}",
|
69 |
-
"negative": "({prompt}), realism, photographic, ordinary, mundane, monochrome, muted, low contrast, {_base}"
|
70 |
-
},
|
71 |
-
"graffiti": {
|
72 |
-
"name": "Graffiti",
|
73 |
-
"positive": "({prompt}), in a graffiti style, street art, creative composition, dynamic lines, spray paint, hip-hop, stylized, bold, vibrant, urban, mural, high contrast, {_base}",
|
74 |
-
"negative": "({prompt}), dull, plain, monochrome, muted, low contrast, {_base}"
|
75 |
-
},
|
76 |
-
"line_art": {
|
77 |
-
"name": "Line Art",
|
78 |
-
"positive": "({prompt}), in a line art drawing style, graphic, illustration, sleek, streamlined, centered composition, solo subject, isolated subject, white background, minimalist arrangement, {_base}",
|
79 |
-
"negative": "({prompt}), off-center, oil, acrylic, watercolor, {_base}"
|
80 |
-
},
|
81 |
-
"papercraft": {
|
82 |
-
"name": "Papercraft",
|
83 |
-
"positive": "({prompt}), as a papercraft model, Kirigami style, folded paper, papercut, sharp edges, intricate design, 3d, layered, textural, color block, centered composition, minimalist arrangement, {_base}",
|
84 |
-
"negative": "({prompt}), 2d, flat, {_base}"
|
85 |
-
},
|
86 |
-
"photography_food": {
|
87 |
-
"name": "Photography: Food",
|
88 |
-
"positive": "({prompt}), food photography style, fresh ingredients, delicious, culinary, real, authentic, macro details, soft natural lighting, high resolution, uhd, centered composition, minimalist arrangement, {_base}",
|
89 |
-
"negative": "({prompt}), unappetizing, fake, artificial, low resolution, {_base}"
|
90 |
-
},
|
91 |
-
"photography_hdr": {
|
92 |
-
"name": "Photography: HDR",
|
93 |
-
"positive": "({prompt}), breathtaking HDR photography, high dynamic range, vivid colors, shadows and highlights, dramatic lighting, high contrast, high resolution, uhd, {_base}",
|
94 |
-
"negative": "({prompt}), flat colors, plain, dull, low dynamic range, low contrast, low resolution, {_base}"
|
95 |
-
},
|
96 |
-
"photography_iphone": {
|
97 |
-
"name": "Photography: iPhone",
|
98 |
-
"positive": "({prompt}), taken by iPhone ProRAW camera, XDR, Retina, depth-of-field, vivid colors, dynamic range, dramatic lighting, real, authentic, high contrast, high resolution, uhd, {_base}",
|
99 |
-
"negative": "({prompt}), shallow depth-of-field, bokeh, fake, artificial, low contrast, low resolution, {_base}"
|
100 |
-
},
|
101 |
-
"photography_iphone_portrait": {
|
102 |
-
"name": "Photography: iPhone Portrait",
|
103 |
-
"positive": "({prompt}), taken by iPhone Portrait Mode, XDR, Retina, shallow depth-of-field, bokeh, vivid colors, dramatic lighting, real, authentic, high contrast, high resolution, uhd, {_base}",
|
104 |
-
"negative": "({prompt}), fake, artificial, low contrast, low resolution, {_base}"
|
105 |
-
},
|
106 |
-
"photography_real_estate": {
|
107 |
-
"name": "Photography: Real Estate",
|
108 |
-
"positive": "({prompt}), real estate photography style, on Zillow, inviting, staged, well-lit, real, authentic, high resolution, uhd, {_base}",
|
109 |
-
"negative": "({prompt}), dark, fake, artificial, low resolution, {_base}"
|
110 |
-
},
|
111 |
-
"photography_street": {
|
112 |
-
"name": "Photography: Street",
|
113 |
-
"positive": "({prompt}), street photography style, taken on Fujifilm X100V, f2 aperture, 35mm, RAW format, candid, authentic, gritty, urban, high contrast, high resolution, uhd, {_base}",
|
114 |
-
"negative": "({prompt}), staged, fake, artificial, low contrast, low resolution, {_base}"
|
115 |
-
},
|
116 |
-
"pointillism": {
|
117 |
-
"name": "Pointillism",
|
118 |
-
"positive": "({prompt}), pointillism style, composed of small dots, inspired by Georges Seurat, intricate design, vibrant, {_base}",
|
119 |
-
"negative": "({prompt}), line drawing, smooth shading, wide color gamut, dull, plain, monochrome, muted, {_base}"
|
120 |
-
},
|
121 |
-
"pop_art": {
|
122 |
-
"name": "Pop Art",
|
123 |
-
"positive": "({prompt}), in a pop art style, inspired by Warhol, bright colors, bold outlines, popular culture, kitsch, vibrant, high contrast, {_base}",
|
124 |
-
"negative": "({prompt}), discrete, objective, dull, plain, monochrome, muted, low contrast, {_base}"
|
125 |
-
},
|
126 |
-
"render": {
|
127 |
-
"name": "Render",
|
128 |
-
"positive": "({prompt}), Octane render, Unreal Engine, volumetric lighting, ray tracing, ambient occlusion, subsurface scattering, high resolution, uhd, {_base}",
|
129 |
-
"negative": "({prompt}), glitch, error, painting, sketch, low resolution, {_base}"
|
130 |
-
},
|
131 |
-
"vaporwave": {
|
132 |
-
"name": "Vaporwave",
|
133 |
-
"positive": "({prompt}), in a vaporwave style, retro aesthetic, neon colors, vibrant, high contrast, {_base}",
|
134 |
-
"negative": "({prompt}), dark, monochrome, muted, low contrast, {_base}"
|
135 |
-
},
|
136 |
-
"watercolor": {
|
137 |
-
"name": "Watercolor",
|
138 |
-
"positive": "({prompt}), painted with watercolors, colorful, painterly, artistic, fluid, {_base}",
|
139 |
-
"negative": "({prompt}), realism, photographic, oil, acrylic, digital, {_base}"
|
140 |
-
}
|
141 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/config.py
CHANGED
@@ -122,7 +122,6 @@ Config = SimpleNamespace(
|
|
122 |
"canny": "lllyasviel/control_v11p_sd15_canny",
|
123 |
},
|
124 |
NEGATIVE_EMBEDDING="fast_negative",
|
125 |
-
STYLE="enhance",
|
126 |
WIDTH=512,
|
127 |
HEIGHT=512,
|
128 |
NUM_IMAGES=1,
|
|
|
122 |
"canny": "lllyasviel/control_v11p_sd15_canny",
|
123 |
},
|
124 |
NEGATIVE_EMBEDDING="fast_negative",
|
|
|
125 |
WIDTH=512,
|
126 |
HEIGHT=512,
|
127 |
NUM_IMAGES=1,
|
lib/inference.py
CHANGED
@@ -14,34 +14,12 @@ from .logger import Logger
|
|
14 |
from .utils import (
|
15 |
annotate_image,
|
16 |
clear_cuda_cache,
|
17 |
-
load_json,
|
18 |
resize_image,
|
19 |
safe_progress,
|
20 |
timer,
|
21 |
)
|
22 |
|
23 |
|
24 |
-
# Inject prompts into style templates
|
25 |
-
def apply_style(positive_prompt, negative_prompt, style_id="none"):
|
26 |
-
if style_id.lower() == "none":
|
27 |
-
return (positive_prompt, negative_prompt)
|
28 |
-
|
29 |
-
styles = load_json("./data/styles.json")
|
30 |
-
style = styles.get(style_id)
|
31 |
-
if style is None:
|
32 |
-
return (positive_prompt, negative_prompt)
|
33 |
-
|
34 |
-
style_base = styles.get("_base", {})
|
35 |
-
return (
|
36 |
-
style.get("positive")
|
37 |
-
.format(prompt=positive_prompt, _base=style_base.get("positive"))
|
38 |
-
.strip(),
|
39 |
-
style.get("negative")
|
40 |
-
.format(prompt=negative_prompt, _base=style_base.get("negative"))
|
41 |
-
.strip(),
|
42 |
-
)
|
43 |
-
|
44 |
-
|
45 |
# Dynamic signature for the GPU duration function
|
46 |
def gpu_duration(**kwargs):
|
47 |
loading = 20
|
@@ -66,7 +44,6 @@ def generate(
|
|
66 |
image_prompt=None,
|
67 |
control_image_prompt=None,
|
68 |
ip_image_prompt=None,
|
69 |
-
style=None,
|
70 |
seed=None,
|
71 |
model="Lykon/dreamshaper-8",
|
72 |
scheduler="DDIM",
|
@@ -88,7 +65,7 @@ def generate(
|
|
88 |
):
|
89 |
start = time.perf_counter()
|
90 |
log = Logger("generate")
|
91 |
-
log.info(f"Generating {num_images} image{'s' if num_images > 1 else ''}")
|
92 |
|
93 |
if Config.ZERO_GPU:
|
94 |
safe_progress(progress, 100, 100, "ZeroGPU init")
|
@@ -178,17 +155,12 @@ def generate(
|
|
178 |
for i in range(num_images):
|
179 |
try:
|
180 |
generator = torch.Generator(device=pipe.device).manual_seed(current_seed)
|
181 |
-
positive_styled, negative_styled = apply_style(positive_prompt, negative_prompt, style)
|
182 |
-
|
183 |
-
# User didn't provide a negative prompt
|
184 |
-
if negative_styled.startswith("(), "):
|
185 |
-
negative_styled = negative_styled[4:]
|
186 |
|
187 |
if negative_embedding:
|
188 |
-
|
189 |
|
190 |
positive_embeds, negative_embeds = compel.pad_conditioning_tensors_to_same_length(
|
191 |
-
[compel(
|
192 |
)
|
193 |
except PromptParser.ParsingException:
|
194 |
raise Error("Invalid prompt")
|
|
|
14 |
from .utils import (
|
15 |
annotate_image,
|
16 |
clear_cuda_cache,
|
|
|
17 |
resize_image,
|
18 |
safe_progress,
|
19 |
timer,
|
20 |
)
|
21 |
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
# Dynamic signature for the GPU duration function
|
24 |
def gpu_duration(**kwargs):
|
25 |
loading = 20
|
|
|
44 |
image_prompt=None,
|
45 |
control_image_prompt=None,
|
46 |
ip_image_prompt=None,
|
|
|
47 |
seed=None,
|
48 |
model="Lykon/dreamshaper-8",
|
49 |
scheduler="DDIM",
|
|
|
65 |
):
|
66 |
start = time.perf_counter()
|
67 |
log = Logger("generate")
|
68 |
+
log.info(f"Generating {num_images} image{'s' if num_images > 1 else ''}...")
|
69 |
|
70 |
if Config.ZERO_GPU:
|
71 |
safe_progress(progress, 100, 100, "ZeroGPU init")
|
|
|
155 |
for i in range(num_images):
|
156 |
try:
|
157 |
generator = torch.Generator(device=pipe.device).manual_seed(current_seed)
|
|
|
|
|
|
|
|
|
|
|
158 |
|
159 |
if negative_embedding:
|
160 |
+
negative_prompt += f", <{Config.NEGATIVE_EMBEDDING}>"
|
161 |
|
162 |
positive_embeds, negative_embeds = compel.pad_conditioning_tensors_to_same_length(
|
163 |
+
[compel(positive_prompt), compel(negative_prompt)]
|
164 |
)
|
165 |
except PromptParser.ParsingException:
|
166 |
raise Error("Invalid prompt")
|