Add FluxGuidance node.

This lets you adjust the guidance on the dev model which is a parameter
that is passed to the diffusion model.
This commit is contained in:
comfyanonymous 2024-08-02 10:24:53 -04:00
parent c1696cd1b5
commit eca962c6da
1 changed files with 21 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import node_helpers
class CLIPTextEncodeFlux: class CLIPTextEncodeFlux:
@classmethod @classmethod
@ -11,7 +12,7 @@ class CLIPTextEncodeFlux:
RETURN_TYPES = ("CONDITIONING",) RETURN_TYPES = ("CONDITIONING",)
FUNCTION = "encode" FUNCTION = "encode"
CATEGORY = "advanced/conditioning" CATEGORY = "advanced/conditioning/flux"
def encode(self, clip, clip_l, t5xxl, guidance): def encode(self, clip, clip_l, t5xxl, guidance):
tokens = clip.tokenize(clip_l) tokens = clip.tokenize(clip_l)
@ -22,6 +23,25 @@ class CLIPTextEncodeFlux:
output["guidance"] = guidance output["guidance"] = guidance
return ([[cond, output]], ) 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 = { NODE_CLASS_MAPPINGS = {
"CLIPTextEncodeFlux": CLIPTextEncodeFlux, "CLIPTextEncodeFlux": CLIPTextEncodeFlux,
"FluxGuidance": FluxGuidance,
} }