mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-06 12:57:06 +08:00
Added EasyCache support to Cosmos Predict t2i
This commit is contained in:
parent
84609ca160
commit
31821a90a4
@ -11,6 +11,7 @@ import math
|
|||||||
from .position_embedding import VideoRopePosition3DEmb, LearnablePosEmbAxis
|
from .position_embedding import VideoRopePosition3DEmb, LearnablePosEmbAxis
|
||||||
from torchvision import transforms
|
from torchvision import transforms
|
||||||
|
|
||||||
|
import comfy.patcher_extension
|
||||||
from comfy.ldm.modules.attention import optimized_attention
|
from comfy.ldm.modules.attention import optimized_attention
|
||||||
|
|
||||||
def apply_rotary_pos_emb(
|
def apply_rotary_pos_emb(
|
||||||
@ -805,7 +806,21 @@ class MiniTrainDIT(nn.Module):
|
|||||||
)
|
)
|
||||||
return x_B_C_Tt_Hp_Wp
|
return x_B_C_Tt_Hp_Wp
|
||||||
|
|
||||||
def forward(
|
def forward(self,
|
||||||
|
x: torch.Tensor,
|
||||||
|
timesteps: torch.Tensor,
|
||||||
|
context: torch.Tensor,
|
||||||
|
fps: Optional[torch.Tensor] = None,
|
||||||
|
padding_mask: Optional[torch.Tensor] = None,
|
||||||
|
**kwargs,
|
||||||
|
):
|
||||||
|
return comfy.patcher_extension.WrapperExecutor.new_class_executor(
|
||||||
|
self._forward,
|
||||||
|
self,
|
||||||
|
comfy.patcher_extension.get_all_wrappers(comfy.patcher_extension.WrappersMP.DIFFUSION_MODEL, kwargs.get("transformer_options", {}))
|
||||||
|
).execute(x, timesteps, context, fps, padding_mask, **kwargs)
|
||||||
|
|
||||||
|
def _forward(
|
||||||
self,
|
self,
|
||||||
x: torch.Tensor,
|
x: torch.Tensor,
|
||||||
timesteps: torch.Tensor,
|
timesteps: torch.Tensor,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user