|
@@ -338,13 +338,14 @@ def slerp(val, low, high):
|
|
|
|
|
|
|
|
|
|
def create_random_tensors(shape, seeds, subseeds=None, subseed_strength=0.0, seed_resize_from_h=0, seed_resize_from_w=0, p=None):
|
|
def create_random_tensors(shape, seeds, subseeds=None, subseed_strength=0.0, seed_resize_from_h=0, seed_resize_from_w=0, p=None):
|
|
|
|
+ eta_noise_seed_delta = opts.eta_noise_seed_delta or 0
|
|
xs = []
|
|
xs = []
|
|
|
|
|
|
# if we have multiple seeds, this means we are working with batch size>1; this then
|
|
# if we have multiple seeds, this means we are working with batch size>1; this then
|
|
# enables the generation of additional tensors with noise that the sampler will use during its processing.
|
|
# enables the generation of additional tensors with noise that the sampler will use during its processing.
|
|
# Using those pre-generated tensors instead of simple torch.randn allows a batch with seeds [100, 101] to
|
|
# Using those pre-generated tensors instead of simple torch.randn allows a batch with seeds [100, 101] to
|
|
# produce the same images as with two batches [100], [101].
|
|
# produce the same images as with two batches [100], [101].
|
|
- 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):
|
|
|
|
|
|
+ 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):
|
|
sampler_noises = [[] for _ in range(p.sampler.number_of_needed_noises(p))]
|
|
sampler_noises = [[] for _ in range(p.sampler.number_of_needed_noises(p))]
|
|
else:
|
|
else:
|
|
sampler_noises = None
|
|
sampler_noises = None
|
|
@@ -384,8 +385,8 @@ def create_random_tensors(shape, seeds, subseeds=None, subseed_strength=0.0, see
|
|
if sampler_noises is not None:
|
|
if sampler_noises is not None:
|
|
cnt = p.sampler.number_of_needed_noises(p)
|
|
cnt = p.sampler.number_of_needed_noises(p)
|
|
|
|
|
|
- if opts.eta_noise_seed_delta > 0:
|
|
|
|
- torch.manual_seed(seed + opts.eta_noise_seed_delta)
|
|
|
|
|
|
+ if eta_noise_seed_delta > 0:
|
|
|
|
+ torch.manual_seed(seed + eta_noise_seed_delta)
|
|
|
|
|
|
for j in range(cnt):
|
|
for j in range(cnt):
|
|
sampler_noises[j].append(devices.randn_without_seed(tuple(noise_shape)))
|
|
sampler_noises[j].append(devices.randn_without_seed(tuple(noise_shape)))
|