Skip to content

SkyReels-V2: Infinite-length Film Generative model

Python

Fix Teacache (#38)

linchunze6ace9655735f
diff --git a/skyreels_v2_infer/modules/transformer.py b/skyreels_v2_infer/modules/transformer.py
index 3bef5ce..7625938 100644
--- a/skyreels_v2_infer/modules/transformer.py
+++ b/skyreels_v2_infer/modules/transformer.py
@@ -759,7 +759,10 @@ class WanModel(ModelMixin, ConfigMixin, PeftAdapterMixin):
for block in self.blocks:
x = block(x, **kwargs)
self.previous_residual_odd = x - ori_x
-
+
+ self.cnt += 1
+ if self.cnt >= self.num_steps:
+ self.cnt = 0
else:
for block in self.blocks:
x = block(x, **kwargs)
@@ -768,9 +771,7 @@ class WanModel(ModelMixin, ConfigMixin, PeftAdapterMixin):
# unpatchify
x = self.unpatchify(x, grid_sizes)
- self.cnt += 1
- if self.cnt >= self.num_steps:
- self.cnt = 0
+
return x.float()
def unpatchify(self, x, grid_sizes):