ComfyUI/comfy/ldm
rattus128 4965c0e2ac
WAN: Fix cache VRAM leak on error (#10141)
If this suffers an exception (such as a VRAM oom) it will leave the
encode() and decode() methods which skips the cleanup of the WAN
feature cache. The comfy node cache then ultimately keeps a reference
this object which is in turn reffing large tensors from the failed
execution.

The feature cache is currently setup at a class variable on the
encoder/decoder however, the encode and decode functions always clear
it on both entry and exit of normal execution.

Its likely the design intent is this is usable as a streaming encoder
where the input comes in batches, however the functions as they are
today don't support that.

So simplify by bringing the cache back to local variable, so that if
it does VRAM OOM the cache itself is properly garbage when the
encode()/decode() functions dissappear from the stack.
2025-10-01 18:42:16 -04:00
..
ace Enable Runtime Selection of Attention Functions (#9639) 2025-09-12 18:07:38 -04:00
audio Enable Runtime Selection of Attention Functions (#9639) 2025-09-12 18:07:38 -04:00
aura Enable Runtime Selection of Attention Functions (#9639) 2025-09-12 18:07:38 -04:00
cascade Enable Runtime Selection of Attention Functions (#9639) 2025-09-12 18:07:38 -04:00
chroma Add support for Chroma Radiance (#9682) 2025-09-13 17:58:43 -04:00
chroma_radiance Changes to the previous radiance commit. (#9851) 2025-09-13 18:03:34 -04:00
cosmos Enable Runtime Selection of Attention Functions (#9639) 2025-09-12 18:07:38 -04:00
flux Reduce Peak WAN inference VRAM usage - part II (#10062) 2025-09-27 18:14:16 -04:00
genmo Enable Runtime Selection of Attention Functions (#9639) 2025-09-12 18:07:38 -04:00
hidream Enable Runtime Selection of Attention Functions (#9639) 2025-09-12 18:07:38 -04:00
hunyuan3d Enable Runtime Selection of Attention Functions (#9639) 2025-09-12 18:07:38 -04:00
hunyuan3dv2_1 Fix issue on old torch. (#9791) 2025-09-10 00:23:47 -04:00
hunyuan_video Support the new hunyuan vae. (#10150) 2025-10-01 17:19:13 -04:00
hydit Change cosmos and hydit models to use the native RMSNorm. (#7934) 2025-05-04 06:26:20 -04:00
lightricks Enable Runtime Selection of Attention Functions (#9639) 2025-09-12 18:07:38 -04:00
lumina Enable Runtime Selection of Attention Functions (#9639) 2025-09-12 18:07:38 -04:00
models Implement hunyuan image refiner model. (#9817) 2025-09-12 00:43:20 -04:00
modules Fix depending on asserts to raise an exception in BatchedBrownianTree and Flash attn module (#9884) 2025-09-15 20:05:03 -04:00
omnigen Enable Runtime Selection of Attention Functions (#9639) 2025-09-12 18:07:38 -04:00
pixart Remove windows line endings. (#8866) 2025-07-11 02:37:51 -04:00
qwen_image Enable Runtime Selection of Attention Functions (#9639) 2025-09-12 18:07:38 -04:00
wan WAN: Fix cache VRAM leak on error (#10141) 2025-10-01 18:42:16 -04:00
common_dit.py add RMSNorm to comfy.ops 2025-04-14 18:00:33 -04:00
util.py Fix and enforce new lines at the end of files. 2024-12-30 04:14:59 -05:00