Proactively delete the partial samples from the callbacks

This commit is contained in:
cmdr2 2023-02-01 11:50:50 +05:30
parent 3e7f14af2c
commit 51443741b8

View File

@ -72,9 +72,10 @@ def generate_images_internal(req: GenerateImageRequest, task_data: TaskData, dat
user_stopped = True
if context.partial_x_samples is not None:
images = latent_samples_to_images(context, context.partial_x_samples)
context.partial_x_samples = None
finally:
gc(context)
if hasattr(context, 'partial_x_samples') and context.partial_x_samples is not None:
del context.partial_x_samples
context.partial_x_samples = None
return images, user_stopped