Better (hopefully) FlashVSR frame selection

First frame was completely discarded before
This commit is contained in:
kijai
2025-10-19 13:49:40 +03:00
parent e8ecda7240
commit a721fe3d0f
+5 -5
View File
@@ -834,11 +834,11 @@ class WanVideoSampler:
flashvsr_LQ_images = image_embeds.get("flashvsr_LQ_images", None)
flashvsr_strength = image_embeds.get("flashvsr_strength", 1.0)
if flashvsr_LQ_images is not None:
if flashvsr_LQ_images.shape[0] < num_frames + 4:
missing_frames = num_frames + 4 - flashvsr_LQ_images.shape[0]
last_frame = flashvsr_LQ_images[-1:].repeat(missing_frames, 1, 1, 1)
flashvsr_LQ_images = torch.cat([flashvsr_LQ_images, last_frame], dim=0)
LQ_images = flashvsr_LQ_images[:num_frames+4].unsqueeze(0).movedim(-1, 1).to(dtype) * 2 - 1
flashvsr_LQ_images = flashvsr_LQ_images[:num_frames]
first_frame = flashvsr_LQ_images[:1]
last_frame = flashvsr_LQ_images[-1:].repeat(3, 1, 1, 1)
flashvsr_LQ_images = torch.cat([first_frame, flashvsr_LQ_images, last_frame], dim=0)
LQ_images = flashvsr_LQ_images.unsqueeze(0).movedim(-1, 1).to(dtype) * 2 - 1
if context_options is None:
flashvsr_LQ_latent = transformer.LQ_proj_in(LQ_images.to(device))
log.info(f"flashvsr_LQ_latent: {flashvsr_LQ_latent[0].shape}")