From be9c5e25bcfbcaa73f3b1654aaa14ccb722b3d1d Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 17 Aug 2023 15:59:56 -0400 Subject: [PATCH] Fix issue with not freeing enough memory when sampling. --- comfy/sample.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/sample.py b/comfy/sample.py index 50e59674..d7292024 100644 --- a/comfy/sample.py +++ b/comfy/sample.py @@ -78,7 +78,7 @@ def sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative real_model = None models = get_additional_models(positive, negative) - comfy.model_management.load_models_gpu([model] + models, comfy.model_management.batch_area_memory(noise.shape[2] * noise.shape[3])) + comfy.model_management.load_models_gpu([model] + models, comfy.model_management.batch_area_memory(noise.shape[0] * noise.shape[2] * noise.shape[3])) real_model = model.model noise = noise.to(device)