Skip to content

Commit

Permalink
Setting seeds to random after exhausted
Browse files Browse the repository at this point in the history
Popping last seeds value does not destroy last element in list, resulting in remaining repeats of prompt to have seed set identical to last seed provided in prompt
  • Loading branch information
DKnight54 authored Jan 27, 2025
1 parent 6e3c1d0 commit 4c7a7c8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gen_img.py
Original file line number Diff line number Diff line change
Expand Up @@ -2835,8 +2835,12 @@ def scale_and_round(x):
# prepare seed
if seeds is not None: # given in prompt
# num_images_per_promptが多い場合は足りなくなるので、足りない分は前のを使う
if len(seeds) > 0:
# Previous implementation may result in unexpected behaiviour when number of seeds is lesss than number of repeats. Last seed is taken for rest of repeated prompts

Check warning on line 2838 in gen_img.py

View workflow job for this annotation

GitHub Actions / build

"behaiviour" should be "behaviour".
if len(seeds) > 1:
seed = seeds.pop(0)
elif len(seeds) == 1:
seed = seeds.pop(0)
seeds = None
else:
if args.iter_same_seed:
seed = iter_seed
Expand All @@ -2847,6 +2851,7 @@ def scale_and_round(x):
seed = seed_random.randint(0, 2**32 - 1)
if args.interactive:
logger.info(f"seed: {seed}")
# logger.info(f"seed: {seed}") #debugging logger. Uncomment to verify if expected seed is added correctly.

# prepare init image, guide image and mask
init_image = mask_image = guide_image = None
Expand Down

0 comments on commit 4c7a7c8

Please sign in to comment.