Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

SD3 better memory usage estimation.

comfyanonymous694e0b48e0f6
diff --git a/comfy/model_base.py b/comfy/model_base.py
index 28458bbab..7ef034408 100644
--- a/comfy/model_base.py
+++ b/comfy/model_base.py
@@ -578,3 +578,15 @@ class SD3(BaseModel):
if cross_attn is not None:
out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn)
return out
+
+ def memory_required(self, input_shape):
+ if comfy.model_management.xformers_enabled() or comfy.model_management.pytorch_attention_flash_attention():
+ dtype = self.get_dtype()
+ if self.manual_cast_dtype is not None:
+ dtype = self.manual_cast_dtype
+ #TODO: this probably needs to be tweaked
+ area = input_shape[0] * input_shape[2] * input_shape[3]
+ return (area * comfy.model_management.dtype_size(dtype) * 0.012) * (1024 * 1024)
+ else:
+ area = input_shape[0] * input_shape[2] * input_shape[3]
+ return (area * 0.3) * (1024 * 1024)