fix normalized prompt when a variation is generated

- The seed printed needs to be the one generated prior to the
  initial noising operation. To do this, I added a new "first_seed"
  argument to the image callback in dream.py.
- Closes #641
This commit is contained in:
Lincoln Stein
2022-09-21 00:32:29 -04:00
parent 0632a3a2ea
commit b93f04ee38
3 changed files with 8 additions and 6 deletions

View File

@ -250,11 +250,12 @@ def main_loop(gen, opt, infile):
results = [] # list of filename, prompt pairs
grid_images = dict() # seed -> Image, only used if `opt.grid`
prior_variations = opt.with_variations or []
first_seed = opt.seed
def image_writer(image, seed, upscaled=False):
def image_writer(image, seed, upscaled=False, first_seed=None):
# note the seed is the seed of the current image
# the first_seed is the original seed that noise is added to
# when the -v switch is used to generate variations
path = None
nonlocal first_seed
nonlocal prior_variations
if opt.grid:
grid_images[seed] = image