Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
d609f603
Commit
d609f603
authored
Apr 07, 2023
by
gk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add [batch_number] and [generation_number] filename patterns
parent
22bcc7be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
modules/images.py
modules/images.py
+6
-0
modules/processing.py
modules/processing.py
+3
-1
No files found.
modules/images.py
View file @
d609f603
...
@@ -352,6 +352,8 @@ class FilenameGenerator:
...
@@ -352,6 +352,8 @@ class FilenameGenerator:
'prompt_no_styles'
:
lambda
self
:
self
.
prompt_no_style
(),
'prompt_no_styles'
:
lambda
self
:
self
.
prompt_no_style
(),
'prompt_spaces'
:
lambda
self
:
sanitize_filename_part
(
self
.
prompt
,
replace_spaces
=
False
),
'prompt_spaces'
:
lambda
self
:
sanitize_filename_part
(
self
.
prompt
,
replace_spaces
=
False
),
'prompt_words'
:
lambda
self
:
self
.
prompt_words
(),
'prompt_words'
:
lambda
self
:
self
.
prompt_words
(),
'batch_number'
:
lambda
self
:
self
.
p
.
batch_index
+
1
,
'generation_number'
:
lambda
self
:
self
.
p
.
iteration
*
self
.
p
.
batch_size
+
self
.
p
.
batch_index
+
1
,
}
}
default_time_format
=
'
%
Y
%
m
%
d
%
H
%
M
%
S'
default_time_format
=
'
%
Y
%
m
%
d
%
H
%
M
%
S'
...
@@ -403,6 +405,10 @@ class FilenameGenerator:
...
@@ -403,6 +405,10 @@ class FilenameGenerator:
for
m
in
re_pattern
.
finditer
(
x
):
for
m
in
re_pattern
.
finditer
(
x
):
text
,
pattern
=
m
.
groups
()
text
,
pattern
=
m
.
groups
()
if
pattern
is
not
None
and
(
pattern
.
lower
()
==
'batch_number'
and
self
.
p
.
batch_size
==
1
or
pattern
.
lower
()
==
'generation_number'
and
self
.
p
.
n_iter
==
1
and
self
.
p
.
batch_size
==
1
):
continue
res
+=
text
res
+=
text
if
pattern
is
None
:
if
pattern
is
None
:
...
...
modules/processing.py
View file @
d609f603
...
@@ -670,6 +670,8 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
...
@@ -670,6 +670,8 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
p
.
scripts
.
postprocess_batch
(
p
,
x_samples_ddim
,
batch_number
=
n
)
p
.
scripts
.
postprocess_batch
(
p
,
x_samples_ddim
,
batch_number
=
n
)
for
i
,
x_sample
in
enumerate
(
x_samples_ddim
):
for
i
,
x_sample
in
enumerate
(
x_samples_ddim
):
p
.
batch_index
=
i
x_sample
=
255.
*
np
.
moveaxis
(
x_sample
.
cpu
()
.
numpy
(),
0
,
2
)
x_sample
=
255.
*
np
.
moveaxis
(
x_sample
.
cpu
()
.
numpy
(),
0
,
2
)
x_sample
=
x_sample
.
astype
(
np
.
uint8
)
x_sample
=
x_sample
.
astype
(
np
.
uint8
)
...
@@ -718,7 +720,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
...
@@ -718,7 +720,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
if
opts
.
return_mask
:
if
opts
.
return_mask
:
output_images
.
append
(
image_mask
)
output_images
.
append
(
image_mask
)
if
opts
.
return_mask_composite
:
if
opts
.
return_mask_composite
:
output_images
.
append
(
image_mask_composite
)
output_images
.
append
(
image_mask_composite
)
...
...
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