Skip to content

Commit 81a2585

Browse files
Better way of doing the generator for the hunyuan image noise aug. (comfyanonymous#9834)
1 parent 101edb0 commit 81a2585

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

comfy/model_base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,9 @@ def concat_cond(self, **kwargs):
14481448
image = self.process_latent_in(image)
14491449
image = utils.resize_to_batch_size(image, noise.shape[0])
14501450
if noise_augmentation > 0:
1451-
noise = torch.randn(image.shape, generator=torch.manual_seed(kwargs.get("seed", 0) - 10), dtype=image.dtype, device="cpu").to(image.device)
1451+
generator = torch.Generator(device="cpu")
1452+
generator.manual_seed(kwargs.get("seed", 0) - 10)
1453+
noise = torch.randn(image.shape, generator=generator, dtype=image.dtype, device="cpu").to(image.device)
14521454
image = noise_augmentation * noise + min(1.0 - noise_augmentation, 0.75) * image
14531455
else:
14541456
image = 0.75 * image

0 commit comments

Comments
 (0)