From 46f569f5711098f82cd141e878aa98261f90fa1a Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Wed, 18 Dec 2024 00:34:12 +0200 Subject: [PATCH] clearer error on frame count mismatch --- hyvideo/modules/models.py | 11 ++++++----- nodes.py | 4 +++- nodes_rf_inversion.py | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/hyvideo/modules/models.py b/hyvideo/modules/models.py index a6f53f8..810f2b7 100644 --- a/hyvideo/modules/models.py +++ b/hyvideo/modules/models.py @@ -175,11 +175,12 @@ def forward( # Apply RoPE if needed. if freqs_cis is not None: - img_qq, img_kk = apply_rotary_emb(img_q, img_k, freqs_cis, head_first=False) - assert ( - img_qq.shape == img_q.shape and img_kk.shape == img_k.shape - ), f"img_kk: {img_qq.shape}, img_q: {img_q.shape}, img_kk: {img_kk.shape}, img_k: {img_k.shape}" - img_q, img_k = img_qq, img_kk + img_q, img_k = apply_rotary_emb(img_q, img_k, freqs_cis, head_first=False) + #img_q, img_k = img_qq, img_kk + #assert ( + # img_qq.shape == img_q.shape and img_kk.shape == img_k.shape + #), f"img_kk: {img_qq.shape}, img_q: {img_q.shape}, img_kk: {img_kk.shape}, img_k: {img_k.shape}" + # Prepare txt for attention. txt_modulated = self.txt_norm1(txt) diff --git a/nodes.py b/nodes.py index efdabf6..b51e6e7 100644 --- a/nodes.py +++ b/nodes.py @@ -1087,7 +1087,7 @@ def process(self, model, hyvid_embeds, flow_shift, steps, embedded_guidance_scal ) if (num_frames - 1) % 4 != 0: raise ValueError( - f"`video_length-1` must be a multiple of 4, got {num_frames}" + f"`video_length - 1 (that's minus one frame)` must be a multiple of 4, got {num_frames}" ) log.info( @@ -1101,6 +1101,8 @@ def process(self, model, hyvid_embeds, flow_shift, steps, embedded_guidance_scal transformer, num_frames, target_height, target_width ) n_tokens = freqs_cos.shape[0] + freqs_cos = freqs_cos.to(dtype).to(device) + freqs_sin = freqs_sin.to(dtype).to(device) diff --git a/nodes_rf_inversion.py b/nodes_rf_inversion.py index 9879b97..4a6982b 100644 --- a/nodes_rf_inversion.py +++ b/nodes_rf_inversion.py @@ -110,7 +110,7 @@ def process(self, model, hyvid_embeds, flow_shift, steps, embedded_guidance_scal ) if (num_frames - 1) % 4 != 0: raise ValueError( - f"`video_length-1` must be a multiple of 4, got {num_frames}" + f"`video_length - 1 (that's minus one frame)` must be a multiple of 4, got {num_frames}" ) log.info( @@ -320,7 +320,7 @@ def process(self, model, hyvid_embeds, flow_shift, steps, embedded_guidance_scal ) if (num_frames - 1) % 4 != 0: raise ValueError( - f"`video_length-1` must be a multiple of 4, got {num_frames}" + f"`video_length - 1 (that's minus one frame)` must be a multiple of 4, got {num_frames}" ) log.info( @@ -498,7 +498,7 @@ def process(self, model, width, height, num_frames, hyvid_embeds, hyvid_embeds_2 ) if (num_frames - 1) % 4 != 0: raise ValueError( - f"`video_length-1` must be a multiple of 4, got {num_frames}" + f"`video_length - 1 (that's minus one frame)` must be a multiple of 4, got {num_frames}" ) log.info(