Skip to content

Commit

Permalink
Merge PR #530 from Kosinkadink/develop
Browse files Browse the repository at this point in the history
Make CustomCFGKeyframe's effective_guarantee_steps check handle start…
  • Loading branch information
Kosinkadink authored Jan 23, 2025
2 parents 7ec4693 + 11cd845 commit abc8025
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions animatediff/sample_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,9 @@ def __init__(self, cfg_multival: Union[float, Tensor], start_percent=0.0, guaran

def get_effective_guarantee_steps(self, max_sigma: torch.Tensor):
'''If keyframe starts before current sampling range (max_sigma), treat as 0.'''
if self.start_t > max_sigma:
return 0
return self.guarantee_steps
if torch.allclose(self.start_t, max_sigma) or self.start_t < max_sigma:
return self.guarantee_steps
return 0

def clone(self):
c = CustomCFGKeyframe(cfg_multival=self.cfg_multival,
Expand Down Expand Up @@ -664,7 +664,11 @@ def clone(self):

def initialize_timesteps(self, model: BaseModel):
for keyframe in self.keyframes:
keyframe.start_t = model.model_sampling.percent_to_sigma(keyframe.start_percent)
to_assign = torch.tensor(model.model_sampling.percent_to_sigma(keyframe.start_percent), device=model.model_sampling.sigma_max.device)
if keyframe.start_percent == 0.0 and to_assign > model.model_sampling.sigma_max:
keyframe.start_t = model.model_sampling.sigma_max
else:
keyframe.start_t = to_assign

def prepare_current_keyframe(self, t: Tensor, transformer_options: dict[str, Tensor]):
curr_t: float = t[0]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "comfyui-animatediff-evolved"
description = "Improved AnimateDiff integration for ComfyUI."
version = "1.4.1"
version = "1.4.2"
license = { file = "LICENSE" }
dependencies = []

Expand Down

0 comments on commit abc8025

Please sign in to comment.