Skip to content

Commit

Permalink
clearer error on frame count mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
kijai committed Dec 17, 2024
1 parent 8a27384 commit 46f569f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
11 changes: 6 additions & 5 deletions hyvideo/modules/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)



Expand Down
6 changes: 3 additions & 3 deletions nodes_rf_inversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 46f569f

Please sign in to comment.