-
Notifications
You must be signed in to change notification settings - Fork 11k
Fix VAEEncodeForInpaint to support WAN VAE tuple downscale_ratio #11259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix VAEEncodeForInpaint to support WAN VAE tuple downscale_ratio #11259
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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! |
- 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
58d8f0b to
c01c1f8
Compare
- Remove conflict markers at lines 1, 2455, 2456, 4910 - Remove duplicate file content after line 2454 - File now correctly ends at 'return import_failed' - Reduced from 7364 to 2452 lines - Verified: No conflict markers remain, Python syntax valid
