Skip to content

Commit

Permalink
SD: Fix repeatable seeds when intial seed is random (#1893)
Browse files Browse the repository at this point in the history
  • Loading branch information
one-lithe-rune authored Oct 15, 2023
1 parent 202ffff commit 71d25ec
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/stable_diffusion/src/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,10 +804,11 @@ def batch_seeds(
seeds = seeds[:batch_count] + [-1] * (batch_count - len(seeds))

if repeatable:
# set seed for the rng based on what we have so far
saved_random_state = random_getstate()
if all(seed < 0 for seed in seeds):
seeds[0] = sanitize_seed(seeds[0])

# set seed for the rng based on what we have so far
saved_random_state = random_getstate()
seed_random(str([n for n in seeds if n > -1]))

# generate any seeds that are unspecified
Expand Down

0 comments on commit 71d25ec

Please sign in to comment.