Skip to content

Commit

Permalink
Quick fix for the promax controlnet.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Jul 14, 2024
1 parent 79547ef commit 7914c47
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions comfy/cldm/cldm.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(
transformer_depth_middle=None,
transformer_depth_output=None,
attn_precision=None,
union_controlnet=False,
union_controlnet_num_control_type=None,
device=None,
operations=comfy.ops.disable_weight_init,
**kwargs,
Expand Down Expand Up @@ -320,8 +320,8 @@ def __init__(
self.middle_block_out = self.make_zero_conv(ch, operations=operations, dtype=self.dtype, device=device)
self._feature_size += ch

if union_controlnet:
self.num_control_type = 6
if union_controlnet_num_control_type is not None:
self.num_control_type = union_controlnet_num_control_type
num_trans_channel = 320
num_trans_head = 8
num_trans_layer = 1
Expand Down
2 changes: 1 addition & 1 deletion comfy/controlnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def load_controlnet(ckpt_path, model=None):
new_sd[diffusers_keys[k]] = controlnet_data.pop(k)

if "control_add_embedding.linear_1.bias" in controlnet_data: #Union Controlnet
controlnet_config["union_controlnet"] = True
controlnet_config["union_controlnet_num_control_type"] = controlnet_data["task_embedding"].shape[0]
for k in list(controlnet_data.keys()):
new_k = k.replace('.attn.in_proj_', '.attn.in_proj.')
new_sd[new_k] = controlnet_data.pop(k)
Expand Down

0 comments on commit 7914c47

Please sign in to comment.