From 78d8035f737d4fe6e4c6f4c6d3dbdddc4277c163 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 24 Jun 2023 11:02:38 -0400 Subject: [PATCH] Fix bug with controlnet. --- comfy/ldm/modules/attention.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/comfy/ldm/modules/attention.py b/comfy/ldm/modules/attention.py index 9b207450..0c54f7f4 100644 --- a/comfy/ldm/modules/attention.py +++ b/comfy/ldm/modules/attention.py @@ -565,7 +565,10 @@ class BasicTransformerBlock(nn.Module): for p in patch: n, context_attn1, value_attn1 = p(n, context_attn1, value_attn1, extra_options) - transformer_block = (block[0], block[1], block_index) + if block is not None: + transformer_block = (block[0], block[1], block_index) + else: + transformer_block = None attn1_replace_patch = transformer_patches_replace.get("attn1", {}) block_attn1 = transformer_block if block_attn1 not in attn1_replace_patch: