From eca962c6dae395cab1258456529030880c188734 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 2 Aug 2024 10:24:53 -0400 Subject: [PATCH] Add FluxGuidance node. This lets you adjust the guidance on the dev model which is a parameter that is passed to the diffusion model. --- comfy_extras/nodes_flux.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/comfy_extras/nodes_flux.py b/comfy_extras/nodes_flux.py index 6c1e8b0e..b690432b 100644 --- a/comfy_extras/nodes_flux.py +++ b/comfy_extras/nodes_flux.py @@ -1,3 +1,4 @@ +import node_helpers class CLIPTextEncodeFlux: @classmethod @@ -11,7 +12,7 @@ class CLIPTextEncodeFlux: RETURN_TYPES = ("CONDITIONING",) FUNCTION = "encode" - CATEGORY = "advanced/conditioning" + CATEGORY = "advanced/conditioning/flux" def encode(self, clip, clip_l, t5xxl, guidance): tokens = clip.tokenize(clip_l) @@ -22,6 +23,25 @@ class CLIPTextEncodeFlux: output["guidance"] = guidance return ([[cond, output]], ) +class FluxGuidance: + @classmethod + def INPUT_TYPES(s): + return {"required": { + "conditioning": ("CONDITIONING", ), + "guidance": ("FLOAT", {"default": 3.5, "min": 0.0, "max": 100.0, "step": 0.1}), + }} + + RETURN_TYPES = ("CONDITIONING",) + FUNCTION = "append" + + CATEGORY = "advanced/conditioning/flux" + + def append(self, conditioning, guidance): + c = node_helpers.conditioning_set_values(conditioning, {"guidance": guidance}) + return (c, ) + + NODE_CLASS_MAPPINGS = { "CLIPTextEncodeFlux": CLIPTextEncodeFlux, + "FluxGuidance": FluxGuidance, }