Skip to content

Commit 1ae8c21

Browse files
committed
Merge branch 'memory-optim' into beta
2 parents 87b0f4f + a04ae91 commit 1ae8c21

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

comfy/sd.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ def encode_tiled_(self, pixel_samples, tile_x=512, tile_y=512, overlap = 64):
212212

213213
def decode(self, samples_in):
214214
self.first_stage_model = self.first_stage_model.to(self.device)
215+
pixel_samples = None
215216
try:
216217
memory_used = self.memory_used_decode(samples_in.shape)
217218
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):
251252
def encode(self, pixel_samples):
252253
self.first_stage_model = self.first_stage_model.to(self.device)
253254
pixel_samples = pixel_samples.movedim(-1,1)
255+
samples = None
254256
try:
255257
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.
256258
model_management.free_memory(memory_used, self.device)

0 commit comments

Comments
 (0)