Skip to content

Conversation

@franciszzj
Copy link
Contributor

@franciszzj franciszzj commented Sep 16, 2025

What does this PR do?

Fix autoencoder_kl_wan.py bugs for Wan2.2 VAE.

  1. When using the Wan2.2 VAE, the spatial compression ratio calculated here is incorrect. It should be 16 instead of 8. Pass it in directly via the config to ensure it’s correct here.
  2. When using enable_tiling with the Wan2.2 VAE, the input is not patchified beforehand, which leads to incorrect results.

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@sayakpaul @yiyixuxu @DN6

When using the Wan2.2 VAE, the spatial compression ratio calculated here is incorrect. It should be 16 instead of 8. Pass it in directly via the config to ensure it’s correct here.
@franciszzj franciszzj changed the title Fix autoencoder_kl_wan.py spatial_compression_ratio bug for Wan2.2 VAE Fix autoencoder_kl_wan.py bugs for Wan2.2 VAE Sep 16, 2025
@sayakpaul sayakpaul requested a review from yiyixuxu September 16, 2025 11:20
Copy link
Collaborator

@yiyixuxu yiyixuxu left a comment

Choose a reason for hiding this comment

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

thank you!

@yiyixuxu
Copy link
Collaborator

cc @sayakpaul do you have a test in the mixin for tiled encode/decode?
if not, maybe we can ask community to help add one

@HuggingFaceDocBuilderDev

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.

@yiyixuxu yiyixuxu merged commit d06750a into huggingface:main Sep 16, 2025
9 of 10 checks passed
oneflyingfish added a commit to oneflyingfish/diffusers that referenced this pull request Sep 17, 2025
@sayakpaul
Copy link
Member

@yiyixuxu we have the tiling test in

def test_enable_disable_tiling(self):

The reason why it might not have been caught is why don't have a separate config for the Wan2.2 VAE in test_models_autoencoder_wan.py. I can add that if you want (I think we should as Wan2.2 VAE is popular).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants