fix: stream Wan VAE decode output to CPU#2042
Open
dexhunter wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1826.
Why
VideoVAE_.decode()currently grows the complete decoded tensor withtorch.cat()at every latent timestep. The node then immediately transfers thecompleted result to CPU float32. For long videos, the repeated GPU accumulation
can exhaust VRAM after sampling has already completed.
This change allocates the final host tensor once and copies each decoded temporal
chunk directly into its final slice. The decoder cache sequence and default
GPU-return behavior are unchanged.
Validation
Autoresearch trace
The source-hashed evaluator uses current main
088128b224242e110d3906c6750e9a3a348a659b, verifies the downloadedWan2_1_VAE_bf16.safetensorsSHA-256, and runs the publicWanVideoVAE.decode()path with fixed-seed latents.For both comparison sizes:
max_abs_error = 0)The candidate also completed the issue-sized 3,497-frame decode with shape
[1, 3, 3497, 480, 640], zero temporal cats, and a 3,633,374,208-byte peak CUDAallocation delta. The final CPU output is 12.89 GB and process RSS reached 19.00
GB, so this addresses VRAM accumulation rather than total host-memory usage.