mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-16 17:42:58 +08:00
Better way of doing the generator for the hunyuan image noise aug. (#9834)
This commit is contained in:
parent
581bae2af3
commit
b149e2e1e3
@ -1448,7 +1448,9 @@ class HunyuanImage21Refiner(HunyuanImage21):
|
|||||||
image = self.process_latent_in(image)
|
image = self.process_latent_in(image)
|
||||||
image = utils.resize_to_batch_size(image, noise.shape[0])
|
image = utils.resize_to_batch_size(image, noise.shape[0])
|
||||||
if noise_augmentation > 0:
|
if noise_augmentation > 0:
|
||||||
noise = torch.randn(image.shape, generator=torch.manual_seed(kwargs.get("seed", 0) - 10), dtype=image.dtype, device="cpu").to(image.device)
|
generator = torch.Generator(device="cpu")
|
||||||
|
generator.manual_seed(kwargs.get("seed", 0) - 10)
|
||||||
|
noise = torch.randn(image.shape, generator=generator, dtype=image.dtype, device="cpu").to(image.device)
|
||||||
image = noise_augmentation * noise + min(1.0 - noise_augmentation, 0.75) * image
|
image = noise_augmentation * noise + min(1.0 - noise_augmentation, 0.75) * image
|
||||||
else:
|
else:
|
||||||
image = 0.75 * image
|
image = 0.75 * image
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user