From 2806499b50d1af32fb689940c3c6d72eb6babfc1 Mon Sep 17 00:00:00 2001 From: Jairo Correa Date: Tue, 21 Nov 2023 19:20:52 -0300 Subject: [PATCH] Initialize variables --- comfy/sd.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/comfy/sd.py b/comfy/sd.py index b8a392af2fe..09db635cb7c 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -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 @@ -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