Skip to content

Commit

Permalink
Add FluxGuidance node.
Browse files Browse the repository at this point in the history
This lets you adjust the guidance on the dev model which is a parameter
that is passed to the diffusion model.
  • Loading branch information
comfyanonymous committed Aug 2, 2024
1 parent c1696cd commit eca962c
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion comfy_extras/nodes_flux.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import node_helpers

class CLIPTextEncodeFlux:
@classmethod
Expand All @@ -11,7 +12,7 @@ def INPUT_TYPES(s):
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)
Expand All @@ -22,6 +23,25 @@ def encode(self, clip, clip_l, t5xxl, guidance):
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,
}

0 comments on commit eca962c

Please sign in to comment.