Skip to content

fix wan i2v num_videos batching, vace latent trim, config scale factors, processor config, modular dtype#14170

Open
akshan-main wants to merge 3 commits into
huggingface:mainfrom
akshan-main:fix-wan-review
Open

fix wan i2v num_videos batching, vace latent trim, config scale factors, processor config, modular dtype#14170
akshan-main wants to merge 3 commits into
huggingface:mainfrom
akshan-main:fix-wan-review

Conversation

@akshan-main

@akshan-main akshan-main commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Part of #13578 (wan review). Same families of issues as the qwenimage review:

  • WanImageToVideoPipeline conditioning batching: image_embeds was repeated by batch_size only (not num_videos_per_prompt) while the latents reach batch_size * num_videos_per_prompt, so num_videos_per_prompt > 1 failed the transformer concat; and list image inputs (a documented PipelineImageInput type) were rejected in check_inputs. Now check_inputs accepts lists, and both image_embeds and the conditioning latents expand from a single image or a per-prompt list up to the effective batch. The first+last-frame path keeps its two-frame layout.
  • WanVACEPipeline(output_type="latent"): the decode path trims the prepended reference latents but the latent path returned them untrimmed, so latent output carried extra frames. The trim now runs before the branch.
  • WanVACEPipeline, WanVideoToVideoPipeline, and the modular Wan pipeline derived scale factors from len(vae.temperal_downsample) and a hardcoded spatial 8 instead of vae.config.scale_factor_spatial / scale_factor_temporal. Now read from config, matching the base WanPipeline.
  • WanAnimateImageProcessor.__init__ accepted vae_scale_factor / vae_latent_channels / resample etc. but called super().__init__() with no args, so the base re-registered defaults over the subclass config. Now forwards them.
  • Modular WanTextInputStep derived block_state.dtype from prompt_embeds.dtype; the denoise blocks cast scheduler timesteps to it, losing precision on bf16/fp16 paths. Now uses transformer.dtype, matching the comment.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline?
  • Did you read our philosophy doc (important for complex PRs)?
  • Was this discussed/approved via a GitHub issue or the forum? Discussed on Slack with @yiyixuxu
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Who can review?

@yiyixuxu

@github-actions

Copy link
Copy Markdown
Contributor

Hi @akshan-main, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Fixes #1234) to the PR description so the issue is linked. See the contribution guide for more details. If this PR intentionally does not fix a tracked issue, a maintainer can add the no-issue-needed label to silence this reminder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant