Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion comfy_execution/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import nodes
import asyncio
import inspect
from comfy_execution.graph_utils import is_link
from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, InputTypeOptions

Expand Down Expand Up @@ -239,8 +240,15 @@ def is_output(node_id):
return True
return False

# If an available node is async, do that first.
# This will execute the asynchronous function earlier, reducing the overall time.
def is_async(node_id):
class_type = self.dynprompt.get_node(node_id)["class_type"]
class_def = nodes.NODE_CLASS_MAPPINGS[class_type]
return inspect.iscoroutinefunction(getattr(class_def, class_def.FUNCTION))

for node_id in node_list:
if is_output(node_id):
if is_output(node_id) or is_async(node_id):
return node_id

#This should handle the VAEDecode -> preview case
Expand Down
9 changes: 6 additions & 3 deletions comfy_extras/nodes_fresca.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ def INPUT_TYPES(s):
DESCRIPTION = "Applies frequency-dependent scaling to the guidance"
def patch(self, model, scale_low, scale_high, freq_cutoff):
def custom_cfg_function(args):
cond = args["conds_out"][0]
uncond = args["conds_out"][1]
conds_out = args["conds_out"]
if len(conds_out) <= 1 or None in args["conds"][:2]:
return conds_out
cond = conds_out[0]
uncond = conds_out[1]

guidance = cond - uncond
filtered_guidance = Fourier_filter(
Expand All @@ -83,7 +86,7 @@ def custom_cfg_function(args):
)
filtered_cond = filtered_guidance + uncond

return [filtered_cond, uncond]
return [filtered_cond, uncond] + conds_out[2:]

m = model.clone()
m.set_model_sampler_pre_cfg_function(custom_cfg_function)
Expand Down
Loading