Now the model merge blocks node will use the longest match.

This commit is contained in:
comfyanonymous 2023-07-04 00:51:17 -04:00
parent 3a09fac835
commit c02f3baeaf
1 changed files with 3 additions and 1 deletions

View File

@ -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, )