Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stable-diffusion-webui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
stable-diffusion-webui
Commits
5e83e708
Commit
5e83e708
authored
Aug 26, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
option to add prompt matrix variable text parts to start of the prompt rather than the end
parent
c9579b51
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
webui.py
webui.py
+10
-5
No files found.
webui.py
View file @
5e83e708
...
...
@@ -90,6 +90,7 @@ class Options:
"jpeg_quality"
:
(
80
,
"Quality for saved jpeg images"
,
1
,
100
),
"verify_input"
:
(
True
,
"Check input, and produce warning if it's too long"
),
"enable_pnginfo"
:
(
True
,
"Save text information about generation parameters as chunks to png files"
),
"prompt_matrix_add_to_start"
:
(
True
,
"In prompt matrix, add the variable combination of text to the start of the prompt, rather than the end"
),
}
def
__init__
(
self
):
...
...
@@ -107,6 +108,9 @@ class Options:
if
item
in
self
.
data
:
return
self
.
data
[
item
]
if
item
in
self
.
data_labels
:
return
self
.
data_labels
[
item
][
0
]
return
super
(
Options
,
self
)
.
__getattribute__
(
item
)
def
save
(
self
,
filename
):
...
...
@@ -568,13 +572,14 @@ def process_images(outpath, func_init, func_sample, prompt, seed, sampler_index,
prompt_matrix_parts
=
prompt
.
split
(
"|"
)
combination_count
=
2
**
(
len
(
prompt_matrix_parts
)
-
1
)
for
combination_num
in
range
(
combination_count
):
current
=
prompt_matrix_parts
[
0
]
selected_prompts
=
[
text
.
strip
()
.
strip
(
','
)
for
n
,
text
in
enumerate
(
prompt_matrix_parts
[
1
:])
if
combination_num
&
(
1
<<
n
)
]
for
n
,
text
in
enumerate
(
prompt_matrix_parts
[
1
:]):
if
combination_num
&
(
2
**
n
)
>
0
:
current
+=
(
""
if
text
.
strip
()
.
startswith
(
","
)
else
", "
)
+
text
if
opts
.
prompt_matrix_add_to_start
:
selected_prompts
=
selected_prompts
+
[
prompt_matrix_parts
[
0
]]
else
:
selected_prompts
=
[
prompt_matrix_parts
[
0
]]
+
selected_prompts
all_prompts
.
append
(
current
)
all_prompts
.
append
(
", "
.
join
(
selected_prompts
)
)
n_iter
=
math
.
ceil
(
len
(
all_prompts
)
/
batch_size
)
all_seeds
=
len
(
all_prompts
)
*
[
seed
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment