aboutsummaryrefslogtreecommitdiffstats
path: root/modules/images.py
diff options
context:
space:
mode:
authorgk <gkpyon@gmail.com>2023-04-07 12:04:46 +0000
committergk <gkpyon@gmail.com>2023-04-07 12:04:46 +0000
commitd609f6030ec464b371a899ced366c62bbd9a4a91 (patch)
tree9a99f07d6951c5d112b82772328f7d0bc1b6256a /modules/images.py
parent22bcc7be428c94e9408f589966c2040187245d81 (diff)
downloadstable-diffusion-webui-gfx803-d609f6030ec464b371a899ced366c62bbd9a4a91.tar.gz
stable-diffusion-webui-gfx803-d609f6030ec464b371a899ced366c62bbd9a4a91.tar.bz2
stable-diffusion-webui-gfx803-d609f6030ec464b371a899ced366c62bbd9a4a91.zip
Add [batch_number] and [generation_number] filename patterns
Diffstat (limited to 'modules/images.py')
-rw-r--r--modules/images.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/images.py b/modules/images.py
index b3535070..5c0cf1d8 100644
--- a/modules/images.py
+++ b/modules/images.py
@@ -352,6 +352,8 @@ class FilenameGenerator:
'prompt_no_styles': lambda self: self.prompt_no_style(),
'prompt_spaces': lambda self: sanitize_filename_part(self.prompt, replace_spaces=False),
'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'
@@ -403,6 +405,10 @@ class FilenameGenerator:
for m in re_pattern.finditer(x):
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
if pattern is None: