mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-07-28 18:37:23 +08:00
Added uuid to conds in CFGGuider and uuids to transformer_options to allow uniquely identifying conds in batches during sampling
This commit is contained in:
parent
4fdfe2f704
commit
1e2777bab1
@ -1,4 +1,5 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
import uuid
|
||||||
import torch
|
import torch
|
||||||
import comfy.model_management
|
import comfy.model_management
|
||||||
import comfy.conds
|
import comfy.conds
|
||||||
@ -45,6 +46,7 @@ def convert_cond(cond):
|
|||||||
model_conds["c_crossattn"] = comfy.conds.CONDCrossAttn(c[0]) #TODO: remove
|
model_conds["c_crossattn"] = comfy.conds.CONDCrossAttn(c[0]) #TODO: remove
|
||||||
temp["cross_attn"] = c[0]
|
temp["cross_attn"] = c[0]
|
||||||
temp["model_conds"] = model_conds
|
temp["model_conds"] = model_conds
|
||||||
|
temp["uuid"] = uuid.uuid4()
|
||||||
out.append(temp)
|
out.append(temp)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ def get_area_and_mult(conds, x_in, timestep_in):
|
|||||||
|
|
||||||
patches['middle_patch'] = [gligen_patch]
|
patches['middle_patch'] = [gligen_patch]
|
||||||
|
|
||||||
cond_obj = collections.namedtuple('cond_obj', ['input_x', 'mult', 'conditioning', 'area', 'control', 'patches'])
|
cond_obj = collections.namedtuple('cond_obj', ['input_x', 'mult', 'conditioning', 'area', 'control', 'patches', 'uuid'])
|
||||||
return cond_obj(input_x, mult, conditioning, area, control, patches)
|
return cond_obj(input_x, mult, conditioning, area, control, patches, conds['uuid'])
|
||||||
|
|
||||||
def cond_equal_size(c1, c2):
|
def cond_equal_size(c1, c2):
|
||||||
if c1 is c2:
|
if c1 is c2:
|
||||||
@ -252,6 +252,7 @@ def outer_calc_cond_batch(model: 'BaseModel', conds: list[list[dict]], x_in: tor
|
|||||||
mult = []
|
mult = []
|
||||||
c = []
|
c = []
|
||||||
cond_or_uncond = []
|
cond_or_uncond = []
|
||||||
|
uuids = []
|
||||||
area = []
|
area = []
|
||||||
control = None
|
control = None
|
||||||
patches = None
|
patches = None
|
||||||
@ -263,6 +264,7 @@ def outer_calc_cond_batch(model: 'BaseModel', conds: list[list[dict]], x_in: tor
|
|||||||
c.append(p.conditioning)
|
c.append(p.conditioning)
|
||||||
area.append(p.area)
|
area.append(p.area)
|
||||||
cond_or_uncond.append(o[1])
|
cond_or_uncond.append(o[1])
|
||||||
|
uuids.append(p.uuid)
|
||||||
control = p.control
|
control = p.control
|
||||||
patches = p.patches
|
patches = p.patches
|
||||||
|
|
||||||
@ -288,6 +290,7 @@ def outer_calc_cond_batch(model: 'BaseModel', conds: list[list[dict]], x_in: tor
|
|||||||
transformer_options["patches"] = patches
|
transformer_options["patches"] = patches
|
||||||
|
|
||||||
transformer_options["cond_or_uncond"] = cond_or_uncond[:]
|
transformer_options["cond_or_uncond"] = cond_or_uncond[:]
|
||||||
|
transformer_options["uuids"] = uuids[:]
|
||||||
transformer_options["sigmas"] = timestep
|
transformer_options["sigmas"] = timestep
|
||||||
|
|
||||||
c['transformer_options'] = transformer_options
|
c['transformer_options'] = transformer_options
|
||||||
|
Loading…
x
Reference in New Issue
Block a user