mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-06-27 10:19:37 +08:00
Enable cfg1 optimization for DualModelGuider
This commit is contained in:
parent
4d360f9c9d
commit
f4f350fcda
@ -933,9 +933,10 @@ class Guider_DualModel(comfy.samplers.CFGGuider):
|
|||||||
|
|
||||||
def predict_noise(self, x, timestep, model_options={}, seed=None):
|
def predict_noise(self, x, timestep, model_options={}, seed=None):
|
||||||
positive = self.conds.get("positive", None)
|
positive = self.conds.get("positive", None)
|
||||||
if self.uncond_inner is None: # cfg == 1 or no negative -> single model, cond only
|
|
||||||
return comfy.samplers.calc_cond_batch(self.inner_model, [positive], x, timestep, model_options)[0]
|
|
||||||
cond = comfy.samplers.calc_cond_batch(self.inner_model, [positive], x, timestep, model_options)[0]
|
cond = comfy.samplers.calc_cond_batch(self.inner_model, [positive], x, timestep, model_options)[0]
|
||||||
|
# uncond model not loaded (base cfg==1/no negative), or cfg driven to 1.0 this step -> single model, cond only
|
||||||
|
if self.uncond_inner is None or (math.isclose(self.cfg, 1.0) and not model_options.get("disable_cfg1_optimization", False)):
|
||||||
|
return cond
|
||||||
|
|
||||||
uncond_model_options = model_options
|
uncond_model_options = model_options
|
||||||
if "multigpu_clones" in model_options: # TODO: support multigpu instead of just running uncond on a single GPU
|
if "multigpu_clones" in model_options: # TODO: support multigpu instead of just running uncond on a single GPU
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user