Skip to content

Add node for forcing tiled VAE encode #7924

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Anghammar
Copy link

When using ComfyUI with Radeon + ROCm + WSL (and possibly other use cases) VAE encode/decode typically always results in OOM and reverts to the tiled version. There is already beta nodes for tiled VAE encode/decode, however some nodes has the VAE encoding "baked in" (e.g. I2V WAN node), thus leaving no options other than waiting for the OOM when encoding VAE.

This pull request adds a subclass to VAE class that overrides encode method with the tiled version, along with a node that will cast a given VAE to the tiled VAE version with desired tiled dimensions. Putting this node after the load VAE node will resolve the issue of having to wait for OOM when encoding VAE.

@Anghammar Anghammar requested a review from comfyanonymous as a code owner May 3, 2025 16:06
@Anghammar Anghammar force-pushed the force-tiled-VAE-node branch from 32319bf to ae2e657 Compare May 10, 2025 10:55
@bigcat88
Copy link
Contributor

Just an idea: maybe this should be done as a simple boolean flag in the regular "Vae Decode" node?

@Anghammar
Copy link
Author

Just an idea: maybe this should be done as a simple boolean flag in the regular "Vae Decode" node?

This is for forcing tiled encoding not decoding, and done in a way such that we don't need to modify any existing node calling the vae encode method. With that said I can't say I am entirely happy with having to mutate an existing instance of a class. I would prefer to solve this with some sort of dependency injection instead, but that would be a large rewrite and probably hard to get approved as a first PR.

@Anghammar Anghammar force-pushed the force-tiled-VAE-node branch from 11a2305 to 40d56bf Compare May 25, 2025 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants