Skip to content

fix(wan-vace): size the noise latent for reference images - #59

Merged
ladipobaruwa-fn merged 3 commits into
mainfrom
fix/vace-reference-image-latent-frames
Sep 15, 2026
Merged

ladipobaruwa-fn merged 3 commits into
mainfrom
fix/vace-reference-image-latent-frames

Conversation

@griptapeops

@griptapeops griptapeops Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Opened by griptapeops[bot] as a draft starting point. This may not be correct or complete as-is; please review, adjust as needed, and mark ready for review (or close) when you pick up the associated work.

What

Prepends one noise latent frame per reference image in prepare_input_latent and trims them back off in prepare_output_latent, so the VACE noise and control branches carry the same frame count. Also rejects a reference count high enough to mean a video was connected rather than individual images.

Why

VACE adds a leading control frame per reference image, and the pipeline only compensates when it sizes the noise latent itself — which this driver bypasses by always passing explicit latents. The mismatch crashed the transformer on a negative control-padding width, making reference images unusable.

Closes #58

@ladipobaruwa-fn
ladipobaruwa-fn force-pushed the fix/vace-reference-image-latent-frames branch 4 times, most recently from 304eeec to e51cf37 Compare September 14, 2026 13:07
@ladipobaruwa-fn
ladipobaruwa-fn marked this pull request as ready for review September 14, 2026 13:10
@ladipobaruwa-fn
ladipobaruwa-fn force-pushed the fix/vace-reference-image-latent-frames branch from e51cf37 to 87424ed Compare September 14, 2026 13:12
@ladipobaruwa-fn ladipobaruwa-fn self-assigned this Sep 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The generator handoff and WAN VACE reference-image documentation updates remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This pull request fixes WAN VACE reference-image latent sizing by aligning noise and control frames, then trimming prepended frames from outputs.

Changes:

  • Adds reference-frame noise handling, trimming, and validation.
  • Renames the latent preparation hook across drivers and helpers.
  • Adds focused tests and updates contributor guidance.
File summaries
File Summary
tests/test_wan_vace_reference_latents.py Tests reference latent and conditioning behavior.
modular_diffusion_nodes_library/parameters/generate_latent_parameters.py Updates latent preparation helper naming.
modular_diffusion_nodes_library/latent_pipeline_drivers/wan_vace.py Implements reference latent handling and limits. Moderate (3 votes): reuse the consumed generator for denoising. Nit (3 votes): update WAN VACE reference-image node documentation.
modular_diffusion_nodes_library/latent_pipeline_drivers/qwen.py Updates the preparation hook override.
modular_diffusion_nodes_library/latent_pipeline_drivers/ltx2.py Updates the preparation hook override.
modular_diffusion_nodes_library/latent_pipeline_drivers/ltx.py Updates hook documentation.
modular_diffusion_nodes_library/latent_pipeline_drivers/flux.py Updates the preparation hook override.
modular_diffusion_nodes_library/latent_pipeline_drivers/base_driver.py Renames and invokes the preparation hook.
docs/adding-new-model.md Updates driver contract guidance.
CLAUDE.md Updates repository guidance.
.github/skills/add-pipeline-variants/SKILL.md Updates variant guidance.
.github/skills/add-modular-pipeline/SKILL.md Updates modular pipeline guidance.
.github/skills/add-modular-pipeline/references/driver-details.md Updates driver details and testing guidance.
Review details
  • Files reviewed: 13/13 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread modular_diffusion_nodes_library/latent_pipeline_drivers/wan_vace.py
Comment thread modular_diffusion_nodes_library/latent_pipeline_drivers/wan_vace.py
griptapeops Bot and others added 3 commits September 15, 2026 12:06
VACE prepends one latent frame per reference image to the control branch.
The pipeline compensates when sizing the noise latent itself, but the
driver always passes an explicit `latents` tensor, which short-circuits
that path — leaving the control branch a frame longer than the noise and
crashing the transformer on a negative control-padding width.

Prepend the matching noise frames on the way in and trim them on the way
out, and reject a reference count large enough to indicate a video was
connected instead of individual images.
@ladipobaruwa-fn
ladipobaruwa-fn force-pushed the fix/vace-reference-image-latent-frames branch from 87424ed to fe00038 Compare September 15, 2026 11:07
@ladipobaruwa-fn
ladipobaruwa-fn merged commit dce15ec into main Sep 15, 2026
4 checks passed
@ladipobaruwa-fn
ladipobaruwa-fn deleted the fix/vace-reference-image-latent-frames branch September 15, 2026 16:21
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.

WAN VACE inpainting crashes with a negative-dimension error when a reference image is added

3 participants