From 27e541b0a5e50ccb7a158bd174774b17a9c3f417 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Fri, 9 May 2025 15:05:40 +0300 Subject: [PATCH] Update models.py --- hyvideo/modules/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hyvideo/modules/models.py b/hyvideo/modules/models.py index 0e76321..766eacf 100644 --- a/hyvideo/modules/models.py +++ b/hyvideo/modules/models.py @@ -1166,6 +1166,12 @@ class HYVideoDiffusionTransformer(ModelMixin, ConfigMixin): self.teacache_skipped_steps_uncond += 1 else: self.teacache_skipped_steps_cond += 1 + + # Verify tensor dimensions match before adding + if img.shape == previous_residual.shape: + img = img + previous_residual.to(img.device) + else: + should_calc = True # Force recalculation if dimensions don't match if should_calc: ori_img = img.clone()