From 0eff43261b94887aca3bdfac0b061136eaf15ca6 Mon Sep 17 00:00:00 2001 From: Rattus Date: Tue, 13 Jan 2026 21:13:35 +1000 Subject: [PATCH] sd: empty cache on tiler fallback This is needed for aimdo where the cache cant self recover from fragmentation. It is however a good thing to do anyway after an OOM so make it unconditional. --- comfy/sd.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/comfy/sd.py b/comfy/sd.py index ca268cbbe..12f1373c5 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -820,6 +820,7 @@ class VAE: do_tile = True if do_tile: + torch.cuda.empty_cache() dims = samples_in.ndim - 2 if dims == 1 or self.extra_1d_channel is not None: pixel_samples = self.decode_tiled_1d(samples_in) @@ -895,6 +896,7 @@ class VAE: do_tile = True if do_tile: + torch.cuda.empty_cache() if self.latent_dim == 3: tile = 256 overlap = tile // 4