Skip to content

Commit 6ace965

Browse files
linchunzesteven-klHowe2018
authored
Fix Teacache (#38)
* support teacache * fix teacache --------- Co-authored-by: Steven <[email protected]> Co-authored-by: Howe <[email protected]>
1 parent 1028f53 commit 6ace965

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

skyreels_v2_infer/modules/transformer.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,10 @@ def forward(self, x, t, context, clip_fea=None, y=None, fps=None):
759759
for block in self.blocks:
760760
x = block(x, **kwargs)
761761
self.previous_residual_odd = x - ori_x
762-
762+
763+
self.cnt += 1
764+
if self.cnt >= self.num_steps:
765+
self.cnt = 0
763766
else:
764767
for block in self.blocks:
765768
x = block(x, **kwargs)
@@ -768,9 +771,7 @@ def forward(self, x, t, context, clip_fea=None, y=None, fps=None):
768771

769772
# unpatchify
770773
x = self.unpatchify(x, grid_sizes)
771-
self.cnt += 1
772-
if self.cnt >= self.num_steps:
773-
self.cnt = 0
774+
774775
return x.float()
775776

776777
def unpatchify(self, x, grid_sizes):

0 commit comments

Comments
 (0)