Skip to content

Commit

Permalink
Zero out conditioning when there is no prompt #1628
Browse files Browse the repository at this point in the history
  • Loading branch information
Acly committed Mar 9, 2025
1 parent efb391e commit 4c51a38
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ai_diffusion/comfy_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,9 @@ def conditioning_step_range(self, conditioning: Output, range: tuple[float, floa
end=range[1],
)

def conditioning_zero_out(self, conditioning: Output):
return self.add("ConditioningZeroOut", 1, conditioning=conditioning)

def instruct_pix_to_pix_conditioning(
self, positive: Output, negative: Output, vae: Output, pixels: Output
):
Expand Down
2 changes: 2 additions & 0 deletions ai_diffusion/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ def encode(self, w: ComfyWorkflow, clip: Output, style_prompt: str | None = None
if text and self.language:
text = w.translate(text)
self._output = w.clip_text_encode(clip, text)
if text == "":
self._output = w.conditioning_zero_out(self._output)
self._clip = clip
return self._output

Expand Down

0 comments on commit 4c51a38

Please sign in to comment.