Skip to content

fix(vace): resample vace_input_masks to match target_num_frames on first chunk#722

Open
livepeer-tessa wants to merge 3 commits intomainfrom
fix/vace-mask-frame-count-mismatch
Open

fix(vace): resample vace_input_masks to match target_num_frames on first chunk#722
livepeer-tessa wants to merge 3 commits intomainfrom
fix/vace-mask-frame-count-mismatch

Conversation

@livepeer-tessa
Copy link
Contributor

Problem

Fixes #721.

On the first chunk (current_start_frame == 0), PreprocessVideoBlock sets target_num_frames = num_frame_per_block * vae_temporal_downsample_factor + 1 (e.g. 13 with defaults). It correctly resamples both video and vace_input_frames to this count — but vace_input_masks was never adjusted.

When masks arrive from a queue or a client parameter they have the base chunk size (e.g. 12 frames), so VaceEncodingBlock._encode_with_conditioning raises:

ValueError: vace_input_masks shape mismatch: expected [B, 1, 13, 512, 512], got [B, 1, 12, 512, 512]

Fix

  • Add vace_input_masks to PreprocessVideoBlock inputs and intermediate_outputs
  • In __call__, resample the temporal dimension of vace_input_masks to target_num_frames whenever it does not already match, using the same linear-interpolation index strategy already used for video / vace_input_frames

Testing

Repro: any workflow that passes vace_input_masks to the longlive pipeline on its first chunk (e.g. pixel-art-preserved-background). After this fix the first chunk processes without shape errors.

leszko and others added 2 commits March 20, 2026 08:19
…ly outputs

Signed-off-by: Rafal Leszko <rafal@livepeer.org>
…eprocessVideoBlock

On the first chunk (current_start_frame == 0), target_num_frames is
num_frame_per_block * vae_temporal_downsample_factor + 1 (e.g. 13 for
default config). PreprocessVideoBlock already resamples 'video' and
'vace_input_frames' to this count, but 'vace_input_masks' was never
adjusted. When masks arrive from a queue or client parameter they have
the base chunk size (e.g. 12 frames), causing VaceEncodingBlock to
raise:

  ValueError: vace_input_masks shape mismatch: expected [B, 1, 13, ...]
              got [B, 1, 12, ...]

Fix: add vace_input_masks to PreprocessVideoBlock inputs/outputs and
resample its temporal dimension to target_num_frames whenever it does
not already match, using the same linear-interpolation index strategy
used for video/vace_input_frames.

Fixes #721

Signed-off-by: livepeer-robot <robot@livepeer.org>
@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: db42c02c-3199-4263-8d71-689b302eabbf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/vace-mask-frame-count-mismatch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.

Change the reviews.profile setting to assertive to make CodeRabbit's nitpick more issues in your PRs.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2026

🚀 fal.ai Preview Deployment

App ID daydream/scope-pr-722--preview
WebSocket wss://fal.run/daydream/scope-pr-722--preview/ws
Commit cd07b5c

Testing

Connect to this preview deployment by running this on your branch:

uv run build && SCOPE_CLOUD_APP_ID="daydream/scope-pr-722--preview/ws" uv run daydream-scope

🧪 E2E tests will run automatically against this deployment.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2026

✅ E2E Tests passed

Status passed
fal App daydream/scope-pr-722--preview
Run View logs

Test Artifacts

Check the workflow run for screenshots.

Signed-off-by: livepeer-robot <robot@livepeer.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VACE crash

2 participants