mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-08-25 21:11:20 +08:00
Use sigmas from transformer_options instead of timesteps to be compatible with a greater amount of models, make end_percent work
This commit is contained in:
parent
6ac21a396c
commit
14a3f02d8d
@ -7,17 +7,17 @@ import comfy.model_patcher
|
|||||||
def easycache_forward_wrapper(executor, *args, **kwargs):
|
def easycache_forward_wrapper(executor, *args, **kwargs):
|
||||||
# get values from args
|
# get values from args
|
||||||
x: torch.Tensor = args[0]
|
x: torch.Tensor = args[0]
|
||||||
timestep: torch.Tensor = args[1]
|
|
||||||
transformer_options: dict[str] = args[-1]
|
transformer_options: dict[str] = args[-1]
|
||||||
# x: torch.Tensor = args[0]
|
# x: torch.Tensor = args[0]
|
||||||
# timestep: torch.Tensor = args[4]
|
# timestep: torch.Tensor = args[4]
|
||||||
# transformer_options: dict[str] = args[-2]
|
# transformer_options: dict[str] = args[-2]
|
||||||
easycache: EasyCacheHolder = transformer_options["easycache"]
|
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)
|
return executor(*args, **kwargs)
|
||||||
# prepare next x_prev
|
# prepare next x_prev
|
||||||
next_x_prev = x.clone()
|
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}")
|
logging.info(f"easycache_wrapper: do_easycache: {do_easycache}")
|
||||||
output_prev_norm = None
|
output_prev_norm = None
|
||||||
input_change = None
|
input_change = None
|
||||||
@ -91,10 +91,10 @@ class EasyCacheHolder:
|
|||||||
self.approx_output_change_rates = []
|
self.approx_output_change_rates = []
|
||||||
|
|
||||||
def is_past_end_timestep(self, timestep: float) -> bool:
|
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:
|
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:
|
def has_x_prev(self) -> bool:
|
||||||
return self.x_prev is not None
|
return self.x_prev is not None
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user