mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Revert "with diffusers cac, always run the original prompt on the first step"
This reverts commit 27ee939e4b3f0929687057f50f75009dde5d09d1.
This commit is contained in:
parent
478c379534
commit
17d73d09c0
@ -108,7 +108,7 @@ class Context:
|
|||||||
return self.tokens_cross_attention_action == Context.Action.APPLY
|
return self.tokens_cross_attention_action == Context.Action.APPLY
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_active_cross_attention_control_types_for_step(self, percent_through:Optional[float]=None, step_size:Optional[float]=None)\
|
def get_active_cross_attention_control_types_for_step(self, percent_through:float=None)\
|
||||||
-> list[CrossAttentionType]:
|
-> list[CrossAttentionType]:
|
||||||
"""
|
"""
|
||||||
Should cross-attention control be applied on the given step?
|
Should cross-attention control be applied on the given step?
|
||||||
@ -117,11 +117,6 @@ class Context:
|
|||||||
"""
|
"""
|
||||||
if percent_through is None:
|
if percent_through is None:
|
||||||
return [CrossAttentionType.SELF, CrossAttentionType.TOKENS]
|
return [CrossAttentionType.SELF, CrossAttentionType.TOKENS]
|
||||||
if step_size is not None:
|
|
||||||
# adjust percent_through to ignore the first step
|
|
||||||
percent_through = (percent_through - step_size) / (1.0 - step_size)
|
|
||||||
if percent_through < 0:
|
|
||||||
return []
|
|
||||||
|
|
||||||
opts = self.arguments.edit_options
|
opts = self.arguments.edit_options
|
||||||
to_control = []
|
to_control = []
|
||||||
|
@ -141,16 +141,13 @@ class InvokeAIDiffuserComponent:
|
|||||||
if step_index is not None and total_step_count is not None:
|
if step_index is not None and total_step_count is not None:
|
||||||
# 🧨diffusers codepath
|
# 🧨diffusers codepath
|
||||||
percent_through = step_index / total_step_count # will never reach 1.0 - this is deliberate
|
percent_through = step_index / total_step_count # will never reach 1.0 - this is deliberate
|
||||||
step_size_percent = 1 / total_step_count
|
|
||||||
else:
|
else:
|
||||||
# legacy compvis codepath
|
# legacy compvis codepath
|
||||||
# TODO remove when compvis codepath support is dropped
|
# TODO remove when compvis codepath support is dropped
|
||||||
if step_index is None and sigma is None:
|
if step_index is None and sigma is None:
|
||||||
raise ValueError(f"Either step_index or sigma is required when doing cross attention control, but both are None.")
|
raise ValueError(f"Either step_index or sigma is required when doing cross attention control, but both are None.")
|
||||||
percent_through = self.estimate_percent_through(step_index, sigma)
|
percent_through = self.estimate_percent_through(step_index, sigma)
|
||||||
# legacy code path supports s_* so we don't need step_size_percent
|
cross_attention_control_types_to_do = context.get_active_cross_attention_control_types_for_step(percent_through)
|
||||||
step_size_percent = None
|
|
||||||
cross_attention_control_types_to_do = context.get_active_cross_attention_control_types_for_step(percent_through, step_size=step_size_percent)
|
|
||||||
|
|
||||||
wants_cross_attention_control = (len(cross_attention_control_types_to_do) > 0)
|
wants_cross_attention_control = (len(cross_attention_control_types_to_do) > 0)
|
||||||
wants_hybrid_conditioning = isinstance(conditioning, dict)
|
wants_hybrid_conditioning = isinstance(conditioning, dict)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user