Uh oh!
There was an error while loading. Please reload this page.
Raise warning and round down if Wan num_frames is not 4k + 1 - #11167
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request ensures that the number of frames passed to the WAN pipelines follows the required format (4 * k + 1).
- In src/diffusers/pipelines/wan/pipeline_wan_i2v.py, the num_frames parameter is added to the function signature and validated.
- In src/diffusers/pipelines/wan/pipeline_wan.py, similar changes are applied to enforce the frame constraint.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/diffusers/pipelines/wan/pipeline_wan_i2v.py | Added num_frames parameter and validation logic to enforce 4*k+1. |
| src/diffusers/pipelines/wan/pipeline_wan.py | Updated function signatures and added the same num_frames check to ensure consistency. |
Comments suppressed due to low confidence (1)
src/diffusers/pipelines/wan/pipeline_wan_i2v.py:331
- Consider adding a check that num_frames is greater than or equal to 1 to ensure the validation accurately reflects a 4*k + 1 form where k >= 0.
if num_frames % 4 != 1:
| callback_on_step_end_tensor_inputs=None, | ||
| ): | ||
| if height % 16 != 0 or width % 16 != 0: | ||
| raise ValueError(f"`height` and `width` have to be divisible by 16 but are {height} and {width}.") |
There was a problem hiding this comment.
Consider enforcing that num_frames is at least 1 before applying the modulo check to handle negative values appropriately.
| raiseValueError(f"`height` and `width` have to be divisible by 16 but are {height} and {width}.") | |
| raiseValueError(f"`height` and `width` have to be divisible by 16 but are {height} and {width}.") | |
| ifnum_frames<1: | |
| raiseValueError("`num_frames` must be at least 1") |
HuggingFaceDocBuilderDev
commented
Mar 28, 2025
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
a-r-r-o-w
commented
Mar 29, 2025
@DN6 I've updated the PR to round down and raise a warning if num_frames is not of the form 4 * k + 1 instead of raising an error as discussed |
Fixes#11163.
Raises a warning if the number of frames to be generated is not a multiple of 4K + 1. The reason for it being that way is because the VAE applies a 4x temporal downscaling/upscaling and the latents are created respecting that.
It is mentioned in the docs.