From b4e915e74560bd2c090f9b4ed6b73b0781b7050e Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 10 Jan 2024 04:08:43 -0500 Subject: [PATCH] Skip SAG when latent is too small. --- comfy_extras/nodes_sag.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/comfy_extras/nodes_sag.py b/comfy_extras/nodes_sag.py index b307b4f..bbd3808 100644 --- a/comfy_extras/nodes_sag.py +++ b/comfy_extras/nodes_sag.py @@ -143,6 +143,8 @@ class SelfAttentionGuidance: sigma = args["sigma"] model_options = args["model_options"] x = args["input"] + if min(cfg_result.shape[2:]) <= 4: #skip when too small to add padding + return cfg_result # create the adversarially blurred image degraded = create_blur_map(uncond_pred, uncond_attn, sag_sigma, sag_threshold)