clearer error on frame count mismatch

This commit is contained in:
kijai
2024-12-18 00:34:12 +02:00
parent 8a273842c6
commit 46f569f571
3 changed files with 12 additions and 9 deletions
+6 -5
View File
@@ -175,11 +175,12 @@ class MMDoubleStreamBlock(nn.Module):
# 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)
+3 -1
View File
@@ -1087,7 +1087,7 @@ class HyVideoSampler:
)
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 @@ class HyVideoSampler:
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)
+3 -3
View File
@@ -110,7 +110,7 @@ class HyVideoInverseSampler:
)
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 @@ class HyVideoReSampler:
)
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 @@ class HyVideoPromptMixSampler:
)
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(