From 8748370f44e28b104fbaa23b4e2e54e64102d799 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Sun, 11 Sep 2022 10:22:32 -0400 Subject: [PATCH] negative -S indexing recovers correct previous seed; closes issue #476 --- scripts/dream.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/dream.py b/scripts/dream.py index ece17d122b9..b1c62dcbee1 100755 --- a/scripts/dream.py +++ b/scripts/dream.py @@ -185,6 +185,7 @@ def main_loop(t2i, outdir, prompt_as_dir, parser, infile): continue if opt.seed is not None and opt.seed < 0: # retrieve previous value! try: + print(f'last seeds = {last_seeds}, opt.seed={opt.seed}') opt.seed = last_seeds[opt.seed] print(f'reusing previous seed {opt.seed}') except IndexError: @@ -242,8 +243,8 @@ def main_loop(t2i, outdir, prompt_as_dir, parser, infile): # Here is where the images are actually generated! try: file_writer = PngWriter(current_outdir) - prefix = file_writer.unique_prefix() - seeds = set() + prefix = file_writer.unique_prefix() + seeds = list() results = [] # list of filename, prompt pairs grid_images = dict() # seed -> Image, only used if `do_grid` def image_writer(image, seed, upscaled=False): @@ -275,7 +276,7 @@ def image_writer(image, seed, upscaled=False): # only append to results if we didn't overwrite an earlier output results.append([path, metadata_prompt]) - seeds.add(seed) + seeds.append(seed) t2i.prompt2image(image_callback=image_writer, **vars(opt))