diff --git a/comfy/sd.py b/comfy/sd.py index b8a392af2fe..5ebe22404dd 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -212,6 +212,7 @@ def encode_tiled_(self, pixel_samples, tile_x=512, tile_y=512, overlap = 64): def decode(self, samples_in): self.first_stage_model = self.first_stage_model.to(self.device) + pixel_samples = None try: memory_used = self.memory_used_decode(samples_in.shape) model_management.free_memory(memory_used, self.device) @@ -251,6 +252,7 @@ def decode_tiled(self, samples, tile_x=64, tile_y=64, overlap = 16): def encode(self, pixel_samples): self.first_stage_model = self.first_stage_model.to(self.device) pixel_samples = pixel_samples.movedim(-1,1) + samples = None try: memory_used = self.memory_used_encode(pixel_samples.shape) #NOTE: this constant along with the one in the decode above are estimated from the mem usage for the VAE and could change. model_management.free_memory(memory_used, self.device)