mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-27 23:00:20 +08:00
Merge branch 'comfyanonymous:master' into master
This commit is contained in:
commit
b6360d36af
@ -3,6 +3,7 @@ from typing import Type, Literal
|
|||||||
|
|
||||||
import nodes
|
import nodes
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import inspect
|
||||||
from comfy_execution.graph_utils import is_link
|
from comfy_execution.graph_utils import is_link
|
||||||
from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, InputTypeOptions
|
from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, InputTypeOptions
|
||||||
|
|
||||||
@ -239,8 +240,15 @@ class ExecutionList(TopologicalSort):
|
|||||||
return True
|
return True
|
||||||
return False
|
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:
|
for node_id in node_list:
|
||||||
if is_output(node_id):
|
if is_output(node_id) or is_async(node_id):
|
||||||
return node_id
|
return node_id
|
||||||
|
|
||||||
#This should handle the VAEDecode -> preview case
|
#This should handle the VAEDecode -> preview case
|
||||||
|
|||||||
@ -71,8 +71,11 @@ class FreSca:
|
|||||||
DESCRIPTION = "Applies frequency-dependent scaling to the guidance"
|
DESCRIPTION = "Applies frequency-dependent scaling to the guidance"
|
||||||
def patch(self, model, scale_low, scale_high, freq_cutoff):
|
def patch(self, model, scale_low, scale_high, freq_cutoff):
|
||||||
def custom_cfg_function(args):
|
def custom_cfg_function(args):
|
||||||
cond = args["conds_out"][0]
|
conds_out = args["conds_out"]
|
||||||
uncond = args["conds_out"][1]
|
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
|
guidance = cond - uncond
|
||||||
filtered_guidance = Fourier_filter(
|
filtered_guidance = Fourier_filter(
|
||||||
@ -83,7 +86,7 @@ class FreSca:
|
|||||||
)
|
)
|
||||||
filtered_cond = filtered_guidance + uncond
|
filtered_cond = filtered_guidance + uncond
|
||||||
|
|
||||||
return [filtered_cond, uncond]
|
return [filtered_cond, uncond] + conds_out[2:]
|
||||||
|
|
||||||
m = model.clone()
|
m = model.clone()
|
||||||
m.set_model_sampler_pre_cfg_function(custom_cfg_function)
|
m.set_model_sampler_pre_cfg_function(custom_cfg_function)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user