Fix VAEEncodeForInpaint to support WAN VAE tuple downscale_ratio#11259
Fix VAEEncodeForInpaint to support WAN VAE tuple downscale_ratio#11259ChrisFab16 wants to merge 1 commit intoComfy-Org:masterfrom
Conversation
ChrisFab16
commented
Dec 11, 2025
- Handle WAN VAE downscale_ratio which is a tuple (function, min, max) instead of integer
- Fixes TypeError when using VAEEncodeForInpaint with Qwen Image/WAN VAEs
- Backward compatible with standard VAEs that use integer downscale_ratio
nodes.py
Outdated
| def encode(self, vae, pixels, mask, grow_mask_by=6): | ||
| x = (pixels.shape[1] // vae.downscale_ratio) * vae.downscale_ratio | ||
| y = (pixels.shape[2] // vae.downscale_ratio) * vae.downscale_ratio | ||
| # Handle WAN VAE downscale_ratio which can be a tuple (function, min, max) |
There was a problem hiding this comment.
are these actually min/max?
It looks like x and y. This code looks like it might be solving the same problem:
def spacial_compression_decode(self):
try:
return self.upscale_ratio[-1]
except:
return self.upscale_ratio
def spacial_compression_encode(self):
try:
return self.downscale_ratio[-1]
except:
return self.downscale_ratio
Can you just call vae.spacial_compression_encode():
x = (pixels.shape[1] // vae.spacial_compression_encode()) * vae.spacial_compression_encode()
y = (pixels.shape[2] // vae.spacial_compression_encode()) * vae.spacial_compression_encode()
|
Thanks for the feedback, @rattus128! |
58d8f0b to
c01c1f8
Compare
Use vae.spacial_compression_encode() instead of directly accessing downscale_ratio to handle both standard VAEs (int) and WAN VAEs (tuple). Addresses reviewer feedback on PR Comfy-Org#11259.
fd6dd34 to
01b86f1
Compare
Use vae.spacial_compression_encode() instead of directly accessing downscale_ratio to handle both standard VAEs (int) and WAN VAEs (tuple). Addresses reviewer feedback on PR Comfy-Org#11259.
) Use vae.spacial_compression_encode() instead of directly accessing downscale_ratio to handle both standard VAEs (int) and WAN VAEs (tuple). Addresses reviewer feedback on PR #11259. Co-authored-by: ChrisFab16 <christopher@fabritius.dk>
Test Evidence CheckIf this PR modifies behavior that requires testing, a test explanation is required. PRs lacking applicable test explanations may not be reviewed until added. Please add test explanations to ensure code quality and prevent regressions. If this PR changes user-facing behavior, visual proof (screen recording or screenshot) is required. PRs without applicable visual documentation may not be reviewed until provided. You can add it by:
|
