Skip to content

Commit 4af3ca5

Browse files
committed
make it so that blank ENSD does not break image generation
1 parent c6f347b commit 4af3ca5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

modules/processing.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,13 +338,14 @@ def slerp(val, low, high):
338338

339339

340340
def create_random_tensors(shape, seeds, subseeds=None, subseed_strength=0.0, seed_resize_from_h=0, seed_resize_from_w=0, p=None):
341+
eta_noise_seed_delta = opts.eta_noise_seed_delta or 0
341342
xs = []
342343

343344
# if we have multiple seeds, this means we are working with batch size>1; this then
344345
# enables the generation of additional tensors with noise that the sampler will use during its processing.
345346
# Using those pre-generated tensors instead of simple torch.randn allows a batch with seeds [100, 101] to
346347
# produce the same images as with two batches [100], [101].
347-
if p is not None and p.sampler is not None and (len(seeds) > 1 and opts.enable_batch_seeds or opts.eta_noise_seed_delta > 0):
348+
if p is not None and p.sampler is not None and (len(seeds) > 1 and opts.enable_batch_seeds or eta_noise_seed_delta > 0):
348349
sampler_noises = [[] for _ in range(p.sampler.number_of_needed_noises(p))]
349350
else:
350351
sampler_noises = None
@@ -384,8 +385,8 @@ def create_random_tensors(shape, seeds, subseeds=None, subseed_strength=0.0, see
384385
if sampler_noises is not None:
385386
cnt = p.sampler.number_of_needed_noises(p)
386387

387-
if opts.eta_noise_seed_delta > 0:
388-
torch.manual_seed(seed + opts.eta_noise_seed_delta)
388+
if eta_noise_seed_delta > 0:
389+
torch.manual_seed(seed + eta_noise_seed_delta)
389390

390391
for j in range(cnt):
391392
sampler_noises[j].append(devices.randn_without_seed(tuple(noise_shape)))

0 commit comments

Comments
 (0)