mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2026-09-06 09:27:00 +08:00
Update model_optimization_nodes.py
This commit is contained in:
parent
0a99e6799a
commit
11a3744c3d
@ -682,7 +682,10 @@ class TorchCompileCosmosModel:
|
|||||||
|
|
||||||
#teacache
|
#teacache
|
||||||
|
|
||||||
from comfy.ldm.wan.model import sinusoidal_embedding_1d
|
try:
|
||||||
|
from comfy.ldm.wan.model import sinusoidal_embedding_1d
|
||||||
|
except:
|
||||||
|
pass
|
||||||
from einops import repeat
|
from einops import repeat
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
from contextlib import nullcontext
|
from contextlib import nullcontext
|
||||||
@ -743,7 +746,7 @@ def teacache_wanvideo_forward_orig(self, x, t, context, clip_fea=None, freqs=Non
|
|||||||
'uncond': {'accumulated_rel_l1_distance': 0, 'prev_input': None,
|
'uncond': {'accumulated_rel_l1_distance': 0, 'prev_input': None,
|
||||||
'teacache_skipped_steps': 0, 'previous_residual': None}
|
'teacache_skipped_steps': 0, 'previous_residual': None}
|
||||||
}
|
}
|
||||||
logging.info("TeaCache: Initialized")
|
logging.info("\nTeaCache: Initialized")
|
||||||
|
|
||||||
cache = self.teacache_state[suffix]
|
cache = self.teacache_state[suffix]
|
||||||
|
|
||||||
@ -845,7 +848,7 @@ class WanVideoTeaCacheKJ:
|
|||||||
if current_step_index == 0:
|
if current_step_index == 0:
|
||||||
if hasattr(diffusion_model, "teacache_state"):
|
if hasattr(diffusion_model, "teacache_state"):
|
||||||
delattr(diffusion_model, "teacache_state")
|
delattr(diffusion_model, "teacache_state")
|
||||||
logging.info("Resetting TeaCache state")
|
logging.info("\nResetting TeaCache state")
|
||||||
|
|
||||||
current_percent = current_step_index / (len(sigmas) - 1)
|
current_percent = current_step_index / (len(sigmas) - 1)
|
||||||
if start_percent <= current_percent <= end_percent:
|
if start_percent <= current_percent <= end_percent:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user