mirror of
https://git.datalinker.icu/kijai/ComfyUI-CogVideoXWrapper.git
synced 2026-05-02 09:00:07 +08:00
clear FasterCache after done
This commit is contained in:
parent
57262d9762
commit
0e8f8140e4
@ -723,8 +723,6 @@ class CogVideoX_Fun_Pipeline_Inpaint(VideoSysPipeline):
|
|||||||
|
|
||||||
device = self._execution_device
|
device = self._execution_device
|
||||||
|
|
||||||
#self.vae.to(device)
|
|
||||||
|
|
||||||
# here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
|
# here `guidance_scale` is defined analog to the guidance weight `w` of equation (2)
|
||||||
# of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
|
# of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1`
|
||||||
# corresponds to doing no classifier free guidance.
|
# corresponds to doing no classifier free guidance.
|
||||||
@ -911,6 +909,7 @@ class CogVideoX_Fun_Pipeline_Inpaint(VideoSysPipeline):
|
|||||||
for i, t in enumerate(timesteps):
|
for i, t in enumerate(timesteps):
|
||||||
if self.interrupt:
|
if self.interrupt:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if use_temporal_tiling and isinstance(self.scheduler, CogVideoXDDIMScheduler):
|
if use_temporal_tiling and isinstance(self.scheduler, CogVideoXDDIMScheduler):
|
||||||
#temporal tiling code based on https://github.com/mayuelala/FollowYourEmoji/blob/main/models/video_pipeline.py
|
#temporal tiling code based on https://github.com/mayuelala/FollowYourEmoji/blob/main/models/video_pipeline.py
|
||||||
# =====================================================
|
# =====================================================
|
||||||
|
|||||||
14
nodes.py
14
nodes.py
@ -772,6 +772,13 @@ class CogVideoSampler:
|
|||||||
)
|
)
|
||||||
if not pipeline["cpu_offloading"]:
|
if not pipeline["cpu_offloading"]:
|
||||||
pipe.transformer.to(offload_device)
|
pipe.transformer.to(offload_device)
|
||||||
|
|
||||||
|
if fastercache is not None:
|
||||||
|
for block in pipe.transformer.transformer_blocks:
|
||||||
|
if (hasattr, block, "cached_hidden_states") and block.cached_hidden_states is not None:
|
||||||
|
block.cached_hidden_states = None
|
||||||
|
block.cached_encoder_hidden_states = None
|
||||||
|
|
||||||
mm.soft_empty_cache()
|
mm.soft_empty_cache()
|
||||||
|
|
||||||
return (pipeline, {"samples": latents})
|
return (pipeline, {"samples": latents})
|
||||||
@ -1012,6 +1019,13 @@ class CogVideoXFunSampler:
|
|||||||
)
|
)
|
||||||
#if not pipeline["cpu_offloading"]:
|
#if not pipeline["cpu_offloading"]:
|
||||||
# pipe.transformer.to(offload_device)
|
# pipe.transformer.to(offload_device)
|
||||||
|
#clear FasterCache
|
||||||
|
if fastercache is not None:
|
||||||
|
for block in pipe.transformer.transformer_blocks:
|
||||||
|
if (hasattr, block, "cached_hidden_states") and block.cached_hidden_states is not None:
|
||||||
|
block.cached_hidden_states = None
|
||||||
|
block.cached_encoder_hidden_states = None
|
||||||
|
|
||||||
mm.soft_empty_cache()
|
mm.soft_empty_cache()
|
||||||
|
|
||||||
return (pipeline, {"samples": latents})
|
return (pipeline, {"samples": latents})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user