Skip to content

Commit

Permalink
Initialize variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jn-jairo committed Nov 21, 2023
1 parent dca30ca commit a04ae91
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions comfy/sd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a04ae91

Please sign in to comment.