Skip to content

fix(vace): auto-convert 3-channel RGB depth masks to single-channel grayscale (#908)#909

Open
livepeer-tessa wants to merge 2 commits intomainfrom
fix/908-vace-rgb-depth-mask-channel
Open

fix(vace): auto-convert 3-channel RGB depth masks to single-channel grayscale (#908)#909
livepeer-tessa wants to merge 2 commits intomainfrom
fix/908-vace-rgb-depth-mask-channel

Conversation

@livepeer-tessa
Copy link
Copy Markdown
Contributor

Problem

When a user wires video-depth-anything → longlive with VACE enabled, the depth map arrives at VaceEncodingBlock._encode_with_conditioning as a [B, 3, F, H, W] tensor (depth value replicated across RGB). VACE expects [B, 1, F, H, W], so a hard ValueError fires on every chunk — ~160+ times in a single session — silently killing all output while the pipeline keeps running.

Reported in: #908

Fix

In _encode_with_conditioning, detect the 3-channel case before the existing channel-count assertion and collapse it to single-channel via channel-average (mean(dim=1, keepdim=True)):

if mask_channels == 3:
    # depth map from video-depth-anything: RGB → grayscale
    input_masks_data = input_masks_data.mean(dim=1, keepdim=True)
    mask_channels = 1

A logger.warning is emitted so operators can see the auto-conversion and optionally wire a true grayscale source. All other unexpected channel counts still raise a clear ValueError.

Testing

  • Reproducer: input → video-depth-anything → longlive (vace_input_frames) → rife → output with vace_enabled=True
  • No ValueError in Loki for the triggering graph
  • Warning logged for the auto-conversion path
  • Pipeline produces normal output for the duration of the session

Related

Tessa (livepeer-tessa) added 2 commits April 10, 2026 06:20
…ds-compat (#895)

Old Scope clients send edge definitions using the deprecated
'source'/'target' key names instead of the current 'from'/'from_port'/
'to_node'/'to_port' fields.  This caused a pydantic ValidationError in
scope.server.frame_processor, resulting in sessions starting but
processing 0 frames (silent failure for users). Error was observed 4x in
a 12 h window.

Changes:
- Add a model_validator(mode='before') on GraphEdge that detects legacy
  'source'/'target' keys and transparently maps them to the current schema.
- When port fields are absent, default from_port to 'video' and to_port to
  'video' (matching the existing convention for simple linear graphs).
- Log a WARNING with the raw edge data whenever legacy keys are coerced so
  operators can identify outdated clients in logs.
- Add tests/test_graph_schema.py covering legacy-only, mixed, and
  current-only edge formats plus the deprecation warning emission.

Fixes #895

Signed-off-by: Tessa (livepeer-tessa) <tessa@livepeer.org>
When video-depth-anything output is wired to longlive's vace_input_frames
port the depth map arrives as a [B, 3, F, H, W] tensor (depth value
replicated across RGB channels) instead of the expected [B, 1, F, H, W]
single-channel mask.  This caused a hard ValueError that fired on every
chunk (~160+ times per session), silently breaking the entire pipeline.

Fix: detect the 3-channel case in _encode_with_conditioning and
automatically collapse it to single-channel via channel-average
(mean(dim=1, keepdim=True)) before the rest of the validation runs.
A logger.warning is emitted so operators can see the conversion happened
and optionally fix the graph to wire a true grayscale source instead.

All other unexpected channel counts still raise a clear ValueError.

Fixes #908

Signed-off-by: Tessa (livepeer-tessa) <tessa@livepeer.org>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 10, 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: 3bceff66-d68b-4184-b05e-c823d18edde8

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/908-vace-rgb-depth-mask-channel

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.

@github-actions
Copy link
Copy Markdown
Contributor

🚀 fal.ai Preview Deployment

App ID daydream/scope-pr-909--preview
WebSocket wss://fal.run/daydream/scope-pr-909--preview/ws
Commit 9f099d5

Livepeer Runner

App ID daydream/scope-livepeer-pr-909--preview
WebSocket wss://fal.run/daydream/scope-livepeer-pr-909--preview/ws
Auth private

Testing Livepeer Mode

SCOPE_CLOUD_MODE=livepeer SCOPE_CLOUD_APP_ID="daydream/scope-livepeer-pr-909--preview/ws" uv run daydream-scope

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.

[fal.ai] longlive/VACE: vace_input_masks must have 1 channel, got 3 — depth map fed as RGB instead of grayscale

1 participant