mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-09-14 21:45:06 +00:00
Add noise augmentation to hunyuan image refiner. (#9831)
This was missing and should help with colors being blown out.
This commit is contained in:
@@ -1437,6 +1437,7 @@ class HunyuanImage21Refiner(HunyuanImage21):
|
||||
def concat_cond(self, **kwargs):
|
||||
noise = kwargs.get("noise", None)
|
||||
image = kwargs.get("concat_latent_image", None)
|
||||
noise_augmentation = kwargs.get("noise_augmentation", 0.0)
|
||||
device = kwargs["device"]
|
||||
|
||||
if image is None:
|
||||
@@ -1446,6 +1447,9 @@ class HunyuanImage21Refiner(HunyuanImage21):
|
||||
image = utils.common_upscale(image.to(device), noise.shape[-1], noise.shape[-2], "bilinear", "center")
|
||||
image = self.process_latent_in(image)
|
||||
image = utils.resize_to_batch_size(image, noise.shape[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)
|
||||
image = noise_augmentation * noise + (1.0 - noise_augmentation) * image
|
||||
return image
|
||||
|
||||
def extra_conds(self, **kwargs):
|
||||
|
Reference in New Issue
Block a user