From 14a3f02d8df6c0165a3f13ddd63295dc4e1989d6 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Tue, 19 Aug 2025 21:35:18 -0700 Subject: [PATCH] Use sigmas from transformer_options instead of timesteps to be compatible with a greater amount of models, make end_percent work --- comfy_extras/nodes_easycache.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/comfy_extras/nodes_easycache.py b/comfy_extras/nodes_easycache.py index a0ae3e7b2..642a192f4 100644 --- a/comfy_extras/nodes_easycache.py +++ b/comfy_extras/nodes_easycache.py @@ -7,17 +7,17 @@ import comfy.model_patcher def easycache_forward_wrapper(executor, *args, **kwargs): # get values from args x: torch.Tensor = args[0] - timestep: torch.Tensor = args[1] transformer_options: dict[str] = args[-1] # x: torch.Tensor = args[0] # timestep: torch.Tensor = args[4] # transformer_options: dict[str] = args[-2] easycache: EasyCacheHolder = transformer_options["easycache"] - if easycache.is_past_end_timestep(timestep): + sigmas = transformer_options["sigmas"] + if sigmas is not None and easycache.is_past_end_timestep(sigmas): return executor(*args, **kwargs) # prepare next x_prev next_x_prev = x.clone() - do_easycache = easycache.should_do_easycache(timestep) + do_easycache = easycache.should_do_easycache(sigmas) logging.info(f"easycache_wrapper: do_easycache: {do_easycache}") output_prev_norm = None input_change = None @@ -91,10 +91,10 @@ class EasyCacheHolder: self.approx_output_change_rates = [] def is_past_end_timestep(self, timestep: float) -> bool: - return not (timestep > self.end_t).item() + return not (timestep[0] > self.end_t).item() def should_do_easycache(self, timestep: float) -> bool: - return (timestep <= self.start_t).item() + return (timestep[0] <= self.start_t).item() def has_x_prev(self) -> bool: return self.x_prev is not None