helper functions for crossfeeding

This commit is contained in:
Johannes Stelzer 2023-02-20 11:44:50 +01:00
parent 7ff6325c30
commit f49ff40f8f
2 changed files with 34 additions and 1 deletions

View File

@ -164,6 +164,39 @@ class LatentBlending():
self.guidance_scale = guidance_scale_effective self.guidance_scale = guidance_scale_effective
self.sdh.guidance_scale = guidance_scale_effective self.sdh.guidance_scale = guidance_scale_effective
def set_branch1_crossfeed(self, crossfeed_power, crossfeed_range, crossfeed_decay):
r"""
Sets the crossfeed parameters for the first branch to the last branch.
Args:
crossfeed_power: float [0,1]
Controls the level of cross-feeding between the first and last image branch.
crossfeed_range: float [0,1]
Sets the duration of active crossfeed during development.
crossfeed_decay: float [0,1]
Sets decay for branch1_crossfeed_power. Lower values make the decay stronger across the range.
"""
self.branch1_crossfeed_power = np.clip(crossfeed_power, 0, 1)
self.branch1_crossfeed_range = np.clip(crossfeed_range, 0, 1)
self.branch1_crossfeed_decay = np.clip(crossfeed_decay, 0, 1)
def set_parental_crossfeed(self, crossfeed_power, crossfeed_range, crossfeed_decay):
r"""
Sets the crossfeed parameters for all transition images (within the first and last branch).
Args:
crossfeed_power: float [0,1]
Controls the level of cross-feeding from the parental branches
crossfeed_range: float [0,1]
Sets the duration of active crossfeed during development.
crossfeed_decay: float [0,1]
Sets decay for branch1_crossfeed_power. Lower values make the decay stronger across the range.
"""
self.parental_crossfeed_power = np.clip(crossfeed_power, 0, 1)
self.parental_crossfeed_range = np.clip(crossfeed_range, 0, 1)
self.parental_crossfeed_power_decay = np.clip(crossfeed_decay, 0, 1)
def set_prompt1(self, prompt: str): def set_prompt1(self, prompt: str):
r""" r"""
Sets the first prompt (for the first keyframe) including text embeddings. Sets the first prompt (for the first keyframe) including text embeddings.

View File

@ -15,7 +15,7 @@
- The value x ranges from [0,1], and the crossfeeding is deactivated after x*num_inference_steps steps - The value x ranges from [0,1], and the crossfeeding is deactivated after x*num_inference_steps steps
## branch1_crossfeed_decay ## branch1_crossfeed_decay
- Sets decay for branch1_crossfeed_power. Lower values make the decay stronger across the range - Sets decay for branch1_crossfeed_power. Lower values make the decay stronger across the range.
- The value x ranges from [0,1], and the branch1_crossfeed_power is decreased until the end of the branch1_crossfeed_range to a value of x*branch1_crossfeed_power - The value x ranges from [0,1], and the branch1_crossfeed_power is decreased until the end of the branch1_crossfeed_range to a value of x*branch1_crossfeed_power
## parental_crossfeed_power ## parental_crossfeed_power