From 696d3033659359143a14470d341db2625e396fa5 Mon Sep 17 00:00:00 2001 From: Extraltodeus Date: Wed, 19 Jun 2024 08:40:54 +0200 Subject: [PATCH] Add files via upload --- nodes.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/nodes.py b/nodes.py index f05f9af..100dcfa 100644 --- a/nodes.py +++ b/nodes.py @@ -1,7 +1,5 @@ import torch -def get_scale(scale,sigmas,sigmin,sigmax): - current = (1 + ((sigmas - sigmax) * (0 - 1)) / (sigmin - sigmax)) ** .5 # forgetting the global parenthesis made me generate a image looking like a negative - return scale * current + (1 - current) + class uncondZeroNode: @classmethod def INPUT_TYPES(s): @@ -23,11 +21,9 @@ class uncondZeroNode: x_orig = args["input"] x_orig -= x_orig.mean() cond -= cond.mean() - current_scale = get_scale(scale,args['sigma'][0].item(), sigmin, sigmax) - return x_orig - cond / cond.std() ** .5 * current_scale + return x_orig - (cond / cond.std() ** .5) * scale new_scale = 1 / (model.model.latent_format.scale_factor * 8) - #Taken and adapted from comfy_extras/nodes_model_advanced def rescale_cfg(args): x_orig = args["input"] @@ -36,8 +32,7 @@ class uncondZeroNode: cond = args["cond_denoised"] cond -= cond.mean() - current_scale = get_scale(scale,args['sigma'][0].item(), sigmin, sigmax) - cond = x_orig - cond / cond.std() ** .5 * current_scale + cond = x_orig - (cond / cond.std() ** .5) * scale sigma = args["sigma"] sigma = sigma.view(sigma.shape[:1] + (1,) * (cond.ndim - 1)) @@ -58,4 +53,4 @@ class uncondZeroNode: m = model.clone() m.set_model_sampler_cfg_function({"uncond_zero":uncond_zero,"rescale_cfg":rescale_cfg}[method]) - return (m, ) + return (m, ) \ No newline at end of file