mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-18 10:33:01 +08:00
Merge branch 'master' into dr-support-pip-cm
This commit is contained in:
commit
ad633b2953
@ -146,7 +146,7 @@ class T5Attention(torch.nn.Module):
|
|||||||
)
|
)
|
||||||
values = self.relative_attention_bias(relative_position_bucket, out_dtype=dtype) # shape (query_length, key_length, num_heads)
|
values = self.relative_attention_bias(relative_position_bucket, out_dtype=dtype) # shape (query_length, key_length, num_heads)
|
||||||
values = values.permute([2, 0, 1]).unsqueeze(0) # shape (1, num_heads, query_length, key_length)
|
values = values.permute([2, 0, 1]).unsqueeze(0) # shape (1, num_heads, query_length, key_length)
|
||||||
return values
|
return values.contiguous()
|
||||||
|
|
||||||
def forward(self, x, mask=None, past_bias=None, optimized_attention=None):
|
def forward(self, x, mask=None, past_bias=None, optimized_attention=None):
|
||||||
q = self.q(x)
|
q = self.q(x)
|
||||||
|
|||||||
@ -609,8 +609,14 @@ class Guider_DualCFG(comfy.samplers.CFGGuider):
|
|||||||
def predict_noise(self, x, timestep, model_options={}, seed=None):
|
def predict_noise(self, x, timestep, model_options={}, seed=None):
|
||||||
negative_cond = self.conds.get("negative", None)
|
negative_cond = self.conds.get("negative", None)
|
||||||
middle_cond = self.conds.get("middle", None)
|
middle_cond = self.conds.get("middle", None)
|
||||||
|
positive_cond = self.conds.get("positive", None)
|
||||||
|
if model_options.get("disable_cfg1_optimization", False) == False:
|
||||||
|
if math.isclose(self.cfg2, 1.0):
|
||||||
|
negative_cond = None
|
||||||
|
if math.isclose(self.cfg1, 1.0):
|
||||||
|
middle_cond = None
|
||||||
|
|
||||||
out = comfy.samplers.calc_cond_batch(self.inner_model, [negative_cond, middle_cond, self.conds.get("positive", None)], x, timestep, model_options)
|
out = comfy.samplers.calc_cond_batch(self.inner_model, [negative_cond, middle_cond, positive_cond], x, timestep, model_options)
|
||||||
return comfy.samplers.cfg_function(self.inner_model, out[1], out[0], self.cfg2, x, timestep, model_options=model_options, cond=middle_cond, uncond=negative_cond) + (out[2] - out[1]) * self.cfg1
|
return comfy.samplers.cfg_function(self.inner_model, out[1], out[0], self.cfg2, x, timestep, model_options=model_options, cond=middle_cond, uncond=negative_cond) + (out[2] - out[1]) * self.cfg1
|
||||||
|
|
||||||
class DualCFGGuider:
|
class DualCFGGuider:
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
comfyui-frontend-package==1.23.4
|
comfyui-frontend-package==1.23.4
|
||||||
comfyui-workflow-templates==0.1.30
|
comfyui-workflow-templates==0.1.31
|
||||||
comfyui-embedded-docs==0.2.3
|
comfyui-embedded-docs==0.2.3
|
||||||
comfyui_manager
|
comfyui_manager
|
||||||
torch
|
torch
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user