From 0445901e9774c7276df67d487295a0ca80d34d5a Mon Sep 17 00:00:00 2001 From: Saquib Alam Date: Fri, 4 Aug 2023 05:11:19 +0530 Subject: [PATCH] Use inverted scaling in parameter --- comfy_extras/nodes_latent.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/comfy_extras/nodes_latent.py b/comfy_extras/nodes_latent.py index f2da37177..65b8deb36 100644 --- a/comfy_extras/nodes_latent.py +++ b/comfy_extras/nodes_latent.py @@ -2,7 +2,7 @@ import torch from nodes import MAX_RESOLUTION # diffusers library scale the random noise -default_vae_scaling_factor = 0.18215 +default_vae_scaling_factor = 1.0/0.18215 class NoisyLatentImage: def __init__(self, device="cpu"): @@ -12,7 +12,7 @@ class NoisyLatentImage: def INPUT_TYPES(s): return {"required": { "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}), - "vae_scaling_factor": ("FLOAT", {"default": default_vae_scaling_factor, "min": 0.01, "max": 1.1, "step": 0.01}), + "vae_scaling_factor": ("FLOAT", {"default": default_vae_scaling_factor, "min": 0.0, "max": 10, "step": 0.01}), "width": ("INT", {"default": 512, "min": 64, "max": MAX_RESOLUTION, "step": 8}), "height": ("INT", {"default": 512, "min": 64, "max": MAX_RESOLUTION, "step": 8}), "batch_size": ("INT", {"default": 1, "min": 1, "max": 64})}} @@ -23,7 +23,7 @@ class NoisyLatentImage: def generate(self, seed, vae_scaling_factor, width, height, batch_size=1): generator = torch.manual_seed(seed) - latent = torch.randn([batch_size, 4, height // 8, width // 8], generator=generator, device=self.device) / vae_scaling_factor + latent = torch.randn([batch_size, 4, height // 8, width // 8], generator=generator, device=self.device) * vae_scaling_factor return ({"samples":latent}, )