From c02f3baeaf00e844057bca3c3c8d7539841591dc Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 4 Jul 2023 00:51:17 -0400 Subject: [PATCH] Now the model merge blocks node will use the longest match. --- comfy_extras/nodes_model_merging.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/comfy_extras/nodes_model_merging.py b/comfy_extras/nodes_model_merging.py index 72eeffb3..9bbb84da 100644 --- a/comfy_extras/nodes_model_merging.py +++ b/comfy_extras/nodes_model_merging.py @@ -46,9 +46,11 @@ class ModelMergeBlocks: ratio = default_ratio k_unet = k[len("diffusion_model."):] + last_arg_size = 0 for arg in kwargs: - if k_unet.startswith(arg): + if k_unet.startswith(arg) and last_arg_size < len(arg): ratio = kwargs[arg] + last_arg_size = len(arg) m.add_patches({k: (sd[k], )}, 1.0 - ratio, ratio) return (m, )