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 2806499
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions comfy/sd.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ def decode(self, samples_in):
samples = samples_in[x:x+batch_number].to(self.vae_dtype).to(self.device)
pixel_samples[x:x+batch_number] = torch.clamp((self.first_stage_model.decode(samples).cpu().float() + 1.0) / 2.0, min=0.0, max=1.0)
except model_management.OOM_EXCEPTION as e:
pixel_samples = None

tile_size = 64
while tile_size >= 8:
overlap = tile_size // 4
Expand Down Expand Up @@ -263,6 +265,8 @@ def encode(self, pixel_samples):
samples[x:x+batch_number] = self.first_stage_model.encode(pixels_in).cpu().float()

except model_management.OOM_EXCEPTION as e:
samples = None

tile_size = 512
while tile_size >= 64:
overlap = tile_size // 8
Expand Down

0 comments on commit 2806499

Please sign in to comment.